@Test public void getConfirmationsWithTypeNullShouldReturnAllConfirmations() { given(repository.findAll()).willReturn(Lists.newArrayList(testConfirmation())); List<Confirmation> confirmations = service.getConfirmations(null); assertThat(confirmations.size()).isEqualTo(1); }
public List<Confirmation> getConfirmations(final String type) { List<Confirmation> confirmations; if (Objects.equals("own", type)) { String username = userService.getUsername(); log.warn(SecurityMarkers.SECURITY_AUDIT, "Querying confirmations for user {}", username); confirmations = repository.findAllByUsername(username); } else { confirmations = repository.findAll(); } log.info("Query returned {} confirmations", confirmations.size()); return confirmations; }
ConfirmationService { public List<Confirmation> getConfirmations(final String type) { List<Confirmation> confirmations; if (Objects.equals("own", type)) { String username = userService.getUsername(); log.warn(SecurityMarkers.SECURITY_AUDIT, "Querying confirmations for user {}", username); confirmations = repository.findAllByUsername(username); } else { confirmations = repository.findAll(); } log.info("Query returned {} confirmations", confirmations.size()); return confirmations; } }
ConfirmationService { public List<Confirmation> getConfirmations(final String type) { List<Confirmation> confirmations; if (Objects.equals("own", type)) { String username = userService.getUsername(); log.warn(SecurityMarkers.SECURITY_AUDIT, "Querying confirmations for user {}", username); confirmations = repository.findAllByUsername(username); } else { confirmations = repository.findAll(); } log.info("Query returned {} confirmations", confirmations.size()); return confirmations; }  }
ConfirmationService { public List<Confirmation> getConfirmations(final String type) { List<Confirmation> confirmations; if (Objects.equals("own", type)) { String username = userService.getUsername(); log.warn(SecurityMarkers.SECURITY_AUDIT, "Querying confirmations for user {}", username); confirmations = repository.findAllByUsername(username); } else { confirmations = repository.findAll(); } log.info("Query returned {} confirmations", confirmations.size()); return confirmations; }  List<Confirmation> getConfirmationsByUsername(@NonNull final String username); Confirmation getConfirmationByUsernameAndEncounterId(@NonNull final String username,
                                                                final long encounterId); Confirmation addConfirmation(@NotNull final String username, final long encounterId); void deleteConfirmation(@NonNull final String username, final long confirmationId); boolean hasConfirmedEncounter(@NonNull final String username, final long encounterId); List<Confirmation> getConfirmations(final String type); }
ConfirmationService { public List<Confirmation> getConfirmations(final String type) { List<Confirmation> confirmations; if (Objects.equals("own", type)) { String username = userService.getUsername(); log.warn(SecurityMarkers.SECURITY_AUDIT, "Querying confirmations for user {}", username); confirmations = repository.findAllByUsername(username); } else { confirmations = repository.findAll(); } log.info("Query returned {} confirmations", confirmations.size()); return confirmations; }  List<Confirmation> getConfirmationsByUsername(@NonNull final String username); Confirmation getConfirmationByUsernameAndEncounterId(@NonNull final String username,
                                                                final long encounterId); Confirmation addConfirmation(@NotNull final String username, final long encounterId); void deleteConfirmation(@NonNull final String username, final long confirmationId); boolean hasConfirmedEncounter(@NonNull final String username, final long encounterId); List<Confirmation> getConfirmations(final String type);  }