@Test public void getLatestEncountersInsideLimitsShouldReturnList() { given(properties.getLatestAmount()).willReturn(2); given(repository.findWithPageable(anyObject())).willReturn(twoTestEncounters()); List<Encounter> latestEncounters = service.getLatestEncounters(); assertThat(latestEncounters.size()).isEqualTo(2); }
public List<Encounter> getLatestEncounters() { Pageable latestEncounters = new PageRequest(0, properties.getLatestAmount(), Sort.Direction.DESC, "date"); List<Encounter> encounters = repository.findWithPageable(latestEncounters); if (encounters.size() > properties.getLatestAmount()) { fireSqlIEvent(); } return encounters; }
EncounterService { public List<Encounter> getLatestEncounters() { Pageable latestEncounters = new PageRequest(0, properties.getLatestAmount(), Sort.Direction.DESC, "date"); List<Encounter> encounters = repository.findWithPageable(latestEncounters); if (encounters.size() > properties.getLatestAmount()) { fireSqlIEvent(); } return encounters; } }
EncounterService { public List<Encounter> getLatestEncounters() { Pageable latestEncounters = new PageRequest(0, properties.getLatestAmount(), Sort.Direction.DESC, "date"); List<Encounter> encounters = repository.findWithPageable(latestEncounters); if (encounters.size() > properties.getLatestAmount()) { fireSqlIEvent(); } return encounters; }  }
EncounterService { public List<Encounter> getLatestEncounters() { Pageable latestEncounters = new PageRequest(0, properties.getLatestAmount(), Sort.Direction.DESC, "date"); List<Encounter> encounters = repository.findWithPageable(latestEncounters); if (encounters.size() > properties.getLatestAmount()) { fireSqlIEvent(); } 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> getLatestEncounters() { Pageable latestEncounters = new PageRequest(0, properties.getLatestAmount(), Sort.Direction.DESC, "date"); List<Encounter> encounters = repository.findWithPageable(latestEncounters); if (encounters.size() > properties.getLatestAmount()) { fireSqlIEvent(); } 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);  }