@Test public void whenGetAllWithEventIdValid() throws Exception { Event event = mock(Event.class); List<Registration> registrations = mock(List.class); when(eventEntityService.getById(TestConstants.EVENT_ID)).thenReturn(event); when(registrationEntityService.getAllWith(event)).thenReturn(registrations); List<Registration> actual = eventRegistrationService.getAllWithEventId(TestConstants.EVENT_ID); verify(eventEntityService).getById(TestConstants.EVENT_ID); verify(registrationEntityService).getAllWith(event); assertThat(actual).isSameAs(registrations); }
public List<Registration> getAllWithEventId(String eventId) throws EntityNotFoundException { Event event = eventEntityService.getById(eventId); return registrationEntityService.getAllWith(event); }
EventRegistrationService { public List<Registration> getAllWithEventId(String eventId) throws EntityNotFoundException { Event event = eventEntityService.getById(eventId); return registrationEntityService.getAllWith(event); } }
EventRegistrationService { public List<Registration> getAllWithEventId(String eventId) throws EntityNotFoundException { Event event = eventEntityService.getById(eventId); return registrationEntityService.getAllWith(event); } @Inject  EventRegistrationService(
            EventEntityService eventEntityService,
            RegistrationEntityService registrationEntityService
    ); }
EventRegistrationService { public List<Registration> getAllWithEventId(String eventId) throws EntityNotFoundException { Event event = eventEntityService.getById(eventId); return registrationEntityService.getAllWith(event); } @Inject  EventRegistrationService(
            EventEntityService eventEntityService,
            RegistrationEntityService registrationEntityService
    ); Registration getByEventIdAndRegistrationId(String eventId, String registrationId); List<Registration> getAllWithEventId(String eventId); Registration add(RegistrationAddPayload addPayload); }
EventRegistrationService { public List<Registration> getAllWithEventId(String eventId) throws EntityNotFoundException { Event event = eventEntityService.getById(eventId); return registrationEntityService.getAllWith(event); } @Inject  EventRegistrationService(
            EventEntityService eventEntityService,
            RegistrationEntityService registrationEntityService
    ); Registration getByEventIdAndRegistrationId(String eventId, String registrationId); List<Registration> getAllWithEventId(String eventId); Registration add(RegistrationAddPayload addPayload);  }