ProgramRepository { public List<String> queryProgramCodesByProgramCodeOrParentCode(final String programCode) throws LMISException { List<Program> programs = queryProgramsByProgramCodeOrParentCode(programCode); List<String> programCodes = FluentIterable.from(programs).transform(program -> program.getProgramCode()).toList(); return programCodes; } @Inject  ProgramRepository(Context context); List<Program> list(); List<Program> listEmergencyPrograms(); void createOrUpdate(Program program); void updateProgramWithRegimen(final List<Program> programs); void createOrUpdateProgramWithProduct(final List<Program> programs); void refresh(Program programsWithProducts); Program queryByCode(final String programCode); List<Long> queryProgramIdsByProgramCodeOrParentCode(final String programCode); List<String> queryProgramCodesByProgramCodeOrParentCode(final String programCode); List<Program> queryProgramsByProgramCodeOrParentCode(final String programCode); void deleteProgramDirtyData(List<String> productCodeList);  }
@Test public void shouldQueryProgramCodesByProgramCodeOrParentCode() throws Exception { insertProgram("MMIA", "MMIA Program", null); insertProgram("PTV", "ptv Program", "MMIA"); insertProgram("TARV", "tarv Program", "MMIA"); insertProgram("VIA", "VIA Program", null); insertProgram("TB", "Nutrition Program", "VIA"); List<String> viaProgramCodes = programRepository.queryProgramCodesByProgramCodeOrParentCode("VIA"); List<String> mmiaProgramCodes = programRepository.queryProgramCodesByProgramCodeOrParentCode("MMIA"); assertTrue(viaProgramCodes.contains("TB")); Assertions.assertThat(mmiaProgramCodes.size()).isGreaterThanOrEqualTo(3); assertTrue(mmiaProgramCodes.contains("PTV") && mmiaProgramCodes.contains("MMIA")); }