@Test public void findOneShouldReturnResultWhenIsPresent() throws Exception { Predicate predicate = mock(Predicate.class); ProcessInstanceEntity processInstanceEntity = mock(ProcessInstanceEntity.class); given(repository.findOne(predicate)).willReturn(Optional.of(processInstanceEntity)); ProcessInstanceEntity retrievedProcessInstanceEntity = entityFinder.findOne(repository, predicate, "error"); assertThat(retrievedProcessInstanceEntity).isEqualTo(processInstanceEntity); }
public <T> T findOne(QuerydslPredicateExecutor<T> predicateExecutor, Predicate predicate, String notFoundMessage) { Optional<T> findResult = predicateExecutor.findOne(predicate); return getEntity(findResult, notFoundMessage); }
EntityFinder { public <T> T findOne(QuerydslPredicateExecutor<T> predicateExecutor, Predicate predicate, String notFoundMessage) { Optional<T> findResult = predicateExecutor.findOne(predicate); return getEntity(findResult, notFoundMessage); } }
EntityFinder { public <T> T findOne(QuerydslPredicateExecutor<T> predicateExecutor, Predicate predicate, String notFoundMessage) { Optional<T> findResult = predicateExecutor.findOne(predicate); return getEntity(findResult, notFoundMessage); }  }
EntityFinder { public <T> T findOne(QuerydslPredicateExecutor<T> predicateExecutor, Predicate predicate, String notFoundMessage) { Optional<T> findResult = predicateExecutor.findOne(predicate); return getEntity(findResult, notFoundMessage); }  T findById(CrudRepository<T, ID> repository,
                              ID id,
                              String notFoundMessage); T findOne(QuerydslPredicateExecutor<T> predicateExecutor,
                         Predicate predicate,
                         String notFoundMessage); }
EntityFinder { public <T> T findOne(QuerydslPredicateExecutor<T> predicateExecutor, Predicate predicate, String notFoundMessage) { Optional<T> findResult = predicateExecutor.findOne(predicate); return getEntity(findResult, notFoundMessage); }  T findById(CrudRepository<T, ID> repository,
                              ID id,
                              String notFoundMessage); T findOne(QuerydslPredicateExecutor<T> predicateExecutor,
                         Predicate predicate,
                         String notFoundMessage);  }