@Test public void shouldGetAllSupportedProgramsForFacility() throws Exception { List<Program> expectedPrograms = new ArrayList<>(); when(programMapper.getByFacilityId(1L)).thenReturn(expectedPrograms); List<Program> programs = programRepository.getByFacility(1L); assertThat(programs, is(expectedPrograms)); verify(programMapper, times(1)).getByFacilityId(1L); }
public List<Program> getByFacility(Long facilityId) { return mapper.getByFacilityId(facilityId); }
ProgramRepository { public List<Program> getByFacility(Long facilityId) { return mapper.getByFacilityId(facilityId); } }
ProgramRepository { public List<Program> getByFacility(Long facilityId) { return mapper.getByFacilityId(facilityId); } @Autowired  ProgramRepository(ProgramMapper programMapper); }
ProgramRepository { public List<Program> getByFacility(Long facilityId) { return mapper.getByFacilityId(facilityId); } @Autowired  ProgramRepository(ProgramMapper programMapper); void insert(Program p); Program update(Program program); List<Program> getByFacility(Long facilityId); List<Program> getAllPullPrograms(); List<Program> getAllPushPrograms(); List<Program> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames); List<Program> getUserSupervisedActiveIvdProgramsWithRights(Long userId, String... rightNames); List<Program> getProgramsSupportedByUserHomeFacilityWithRights(Long facilityId, Long userId, String... rightNames); List<Program> getIvdProgramsSupportedByUserHomeFacilityWithRights(Long facilityId, Long userId, String... rightNames); Long getIdByCode(String code); List<Program> getActiveProgramsForUserWithRights(Long userId, String... rightNames); Program getById(Long id); void setTemplateConfigured(Long id); List<Program> getProgramsForUserByFacilityAndRights(Long facilityId, Long userId, String... rightNames); List<Program> getAll(); Program getByCode(String code); void setRegimenTemplateConfigured(Long programId); void setFeedSendFlag(Program program, Boolean sendFeed); List<Program> getProgramsForNotification(); List<Program> getAllIvdPrograms(); }
ProgramRepository { public List<Program> getByFacility(Long facilityId) { return mapper.getByFacilityId(facilityId); } @Autowired  ProgramRepository(ProgramMapper programMapper); void insert(Program p); Program update(Program program); List<Program> getByFacility(Long facilityId); List<Program> getAllPullPrograms(); List<Program> getAllPushPrograms(); List<Program> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames); List<Program> getUserSupervisedActiveIvdProgramsWithRights(Long userId, String... rightNames); List<Program> getProgramsSupportedByUserHomeFacilityWithRights(Long facilityId, Long userId, String... rightNames); List<Program> getIvdProgramsSupportedByUserHomeFacilityWithRights(Long facilityId, Long userId, String... rightNames); Long getIdByCode(String code); List<Program> getActiveProgramsForUserWithRights(Long userId, String... rightNames); Program getById(Long id); void setTemplateConfigured(Long id); List<Program> getProgramsForUserByFacilityAndRights(Long facilityId, Long userId, String... rightNames); List<Program> getAll(); Program getByCode(String code); void setRegimenTemplateConfigured(Long programId); void setFeedSendFlag(Program program, Boolean sendFeed); List<Program> getProgramsForNotification(); List<Program> getAllIvdPrograms(); static String PROGRAM_CODE_INVALID; }