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

    documentRepositoryImpl.findUniqueOrNone(new Document());
  }
  @Test
  public void testFindUniqueOrNoneCaseUnique() {
    Document unique = new Document();

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

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

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