ConfirmationService { public Confirmation getConfirmationByUsernameAndEncounterId(@NonNull final String username, final long encounterId) { Confirmation confirmation = repository.findByUsernameAndEncounterId(username, encounterId); log.info("Query for user {} confirmations returned {}", username, confirmation); return confirmation; }  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);  }
@Test public void getConfirmationByUsernameAndEncounterIdWhenUsernameAndIdAreValidShouldReturnConfirmation() { given(repository.findByUsernameAndEncounterId(anyString(), anyLong())).willReturn(testConfirmation()); Confirmation confirmation = service.getConfirmationByUsernameAndEncounterId("test", 1); assertThat(confirmation.getId()).isEqualTo(1); }