@Test public void shouldGetAllSupportedProgramsForFacility() throws Exception { final Facility facility = make(a(defaultFacility)); facility.setId(1L); final ProgramSupported hivProgram = make(a(defaultProgramSupported, with(supportedProgram, new Program(1L)), with(supportedFacilityId, facility.getId()))); List<ProgramSupported> programs = new ArrayList<ProgramSupported>() {{ add(make(a(defaultProgramSupported, with(supportedFacilityId, facility.getId())))); add(hivProgram); }}; when(programSupportedMapper.getAllByFacilityId(facility.getId())).thenReturn(programs); facility.setSupportedPrograms(programs); assertThat(programSupportedRepository.getAllByFacilityId(facility.getId()), is(programs)); verify(programSupportedMapper).getAllByFacilityId(facility.getId()); }
public List<ProgramSupported> getAllByFacilityId(Long facilityId) { return mapper.getAllByFacilityId(facilityId); }
ProgramSupportedRepository { public List<ProgramSupported> getAllByFacilityId(Long facilityId) { return mapper.getAllByFacilityId(facilityId); } }
ProgramSupportedRepository { public List<ProgramSupported> getAllByFacilityId(Long facilityId) { return mapper.getAllByFacilityId(facilityId); }  }
ProgramSupportedRepository { public List<ProgramSupported> getAllByFacilityId(Long facilityId) { return mapper.getAllByFacilityId(facilityId); }  Date getProgramStartDate(Long facilityId, Long programId); void deleteSupportedPrograms(Long facilityId, Long programId); void addSupportedProgram(ProgramSupported programSupported); boolean updateSupportedPrograms(Facility facility); List<ProgramSupported> getAllByFacilityId(Long facilityId); ProgramSupported getByFacilityIdAndProgramId(Long facilityId, Long programId); void updateSupportedProgram(ProgramSupported programSupported); List<ProgramSupported> getActiveByFacilityId(Long facilityId); void updateForVirtualFacilities(Facility parentFacility); }
ProgramSupportedRepository { public List<ProgramSupported> getAllByFacilityId(Long facilityId) { return mapper.getAllByFacilityId(facilityId); }  Date getProgramStartDate(Long facilityId, Long programId); void deleteSupportedPrograms(Long facilityId, Long programId); void addSupportedProgram(ProgramSupported programSupported); boolean updateSupportedPrograms(Facility facility); List<ProgramSupported> getAllByFacilityId(Long facilityId); ProgramSupported getByFacilityIdAndProgramId(Long facilityId, Long programId); void updateSupportedProgram(ProgramSupported programSupported); List<ProgramSupported> getActiveByFacilityId(Long facilityId); void updateForVirtualFacilities(Facility parentFacility);  }