@SuppressWarnings("unchecked")
  @Test(expected = NonUniqueResultException.class)
  public void testFindUniqueCaseMultiple() {
    when(documentDao.findUnique(any(Document.class), any(SearchParameters.class)))
        .thenThrow(NonUniqueResultException.class);

    documentRepositoryImpl.findUnique(new Document());
  }
  @Test
  public void testFindUniqueCaseUnique() {
    Document unique = new Document();

    when(documentDao.findUnique(any(Document.class), any(SearchParameters.class)))
        .thenReturn(unique);

    Document result = documentRepositoryImpl.findUnique(new Document());

    assertThat(result).isNotNull();
    verify(documentDao, times(1)).findUnique(any(Document.class), any(SearchParameters.class));
  }