@Test public void getEncountersByUsernameShouldReturnList() { given(repository.findAllByUsername(anyString())).willReturn(threeTestEncounters()); List<Encounter> encounters = service.getEncountersByUsername("test"); assertThat(encounters.size()).isEqualTo(3); }
public List<Encounter> getEncountersByUsername(@NotNull final String username) { List<Encounter> encounters = repository.findAllByUsername(username); log.info("Query for user {} encounters returned {} encounters", username, encounters.size()); return encounters; }
EncounterService { public List<Encounter> getEncountersByUsername(@NotNull final String username) { List<Encounter> encounters = repository.findAllByUsername(username); log.info("Query for user {} encounters returned {} encounters", username, encounters.size()); return encounters; } }
EncounterService { public List<Encounter> getEncountersByUsername(@NotNull final String username) { List<Encounter> encounters = repository.findAllByUsername(username); log.info("Query for user {} encounters returned {} encounters", username, encounters.size()); return encounters; }  }
EncounterService { public List<Encounter> getEncountersByUsername(@NotNull final String username) { List<Encounter> encounters = repository.findAllByUsername(username); log.info("Query for user {} encounters returned {} encounters", username, encounters.size()); return encounters; }  List<Encounter> getLatestEncounters(); List<Encounter> getEncounters(@NotNull final SearchFilter filter); Encounter getEncounterById(@NotNull final long encounterId); List<Encounter> getEncountersByUsername(@NotNull final String username); List<Encounter> getEncountersByEvent(@NotNull final String event); List<Encounter> getEncounters(final String type); @Transactional void deleteEncounter(@NotNull final long encounterId); @Transactional Encounter createEncounter(@NotNull final Encounter newEncounter); boolean isOwnEncounter(@NotNull final long encounterId, @NotNull final String username); }
EncounterService { public List<Encounter> getEncountersByUsername(@NotNull final String username) { List<Encounter> encounters = repository.findAllByUsername(username); log.info("Query for user {} encounters returned {} encounters", username, encounters.size()); return encounters; }  List<Encounter> getLatestEncounters(); List<Encounter> getEncounters(@NotNull final SearchFilter filter); Encounter getEncounterById(@NotNull final long encounterId); List<Encounter> getEncountersByUsername(@NotNull final String username); List<Encounter> getEncountersByEvent(@NotNull final String event); List<Encounter> getEncounters(final String type); @Transactional void deleteEncounter(@NotNull final long encounterId); @Transactional Encounter createEncounter(@NotNull final Encounter newEncounter); boolean isOwnEncounter(@NotNull final long encounterId, @NotNull final String username);  }