@Test public void shouldGetProgramsSupportedByFacilitySupervisedByUserWithRights() throws Exception { Long userId = 1L; List<Program> programs = new ArrayList<>(); when(programMapper.getUserSupervisedActivePrograms(userId, "{AUTHORIZE_REQUISITION, CREATE_REQUISITION}")).thenReturn(programs); List<Program> result = programRepository.getUserSupervisedActiveProgramsWithRights(userId, AUTHORIZE_REQUISITION, CREATE_REQUISITION); verify(programMapper).getUserSupervisedActivePrograms(userId, "{AUTHORIZE_REQUISITION, CREATE_REQUISITION}"); assertThat(result, is(programs)); }
public List<Program> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames) { return mapper.getUserSupervisedActivePrograms(userId, commaSeparateRightNames(rightNames)); }
ProgramRepository { public List<Program> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames) { return mapper.getUserSupervisedActivePrograms(userId, commaSeparateRightNames(rightNames)); } }
ProgramRepository { public List<Program> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames) { return mapper.getUserSupervisedActivePrograms(userId, commaSeparateRightNames(rightNames)); } @Autowired  ProgramRepository(ProgramMapper programMapper); }
ProgramRepository { public List<Program> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames) { return mapper.getUserSupervisedActivePrograms(userId, commaSeparateRightNames(rightNames)); } @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> getUserSupervisedActiveProgramsWithRights(Long userId, String... rightNames) { return mapper.getUserSupervisedActivePrograms(userId, commaSeparateRightNames(rightNames)); } @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; }