@Test public void shouldRetrieveAlreadyDefinedRnrColumnsForAProgram() throws Exception { when(programRnrColumnMapper.isRnrTemplateDefined(EXISTING_PROGRAM_ID)).thenReturn(true); when(programRnrColumnMapper.fetchDefinedRnrColumnsForProgram(EXISTING_PROGRAM_ID)).thenReturn(rnrColumns); List<RnrColumn> result = rnrRepository.fetchRnrTemplateColumnsOrMasterColumns(EXISTING_PROGRAM_ID); assertThat(result, is(rnrColumns)); verify(programRnrColumnMapper, never()).fetchAllMasterRnRColumns(); verify(programRnrColumnMapper).fetchDefinedRnrColumnsForProgram(EXISTING_PROGRAM_ID); }
public List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId) { if (programRnrColumnMapper.isRnrTemplateDefined(programId)) { return programRnrColumnMapper.fetchDefinedRnrColumnsForProgram(programId); } else { return programRnrColumnMapper.fetchAllMasterRnRColumns(); } }
RnrTemplateRepository { public List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId) { if (programRnrColumnMapper.isRnrTemplateDefined(programId)) { return programRnrColumnMapper.fetchDefinedRnrColumnsForProgram(programId); } else { return programRnrColumnMapper.fetchAllMasterRnRColumns(); } } }
RnrTemplateRepository { public List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId) { if (programRnrColumnMapper.isRnrTemplateDefined(programId)) { return programRnrColumnMapper.fetchDefinedRnrColumnsForProgram(programId); } else { return programRnrColumnMapper.fetchAllMasterRnRColumns(); } }  }
RnrTemplateRepository { public List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId) { if (programRnrColumnMapper.isRnrTemplateDefined(programId)) { return programRnrColumnMapper.fetchDefinedRnrColumnsForProgram(programId); } else { return programRnrColumnMapper.fetchAllMasterRnRColumns(); } }  void saveProgramRnrTemplate(ProgramRnrTemplate programTemplate); List<RnrColumn> fetchColumnsForRequisition(Long programId); List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId); boolean isFormulaValidationRequired(Program program); }
RnrTemplateRepository { public List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId) { if (programRnrColumnMapper.isRnrTemplateDefined(programId)) { return programRnrColumnMapper.fetchDefinedRnrColumnsForProgram(programId); } else { return programRnrColumnMapper.fetchAllMasterRnRColumns(); } }  void saveProgramRnrTemplate(ProgramRnrTemplate programTemplate); List<RnrColumn> fetchColumnsForRequisition(Long programId); List<RnrColumn> fetchRnrTemplateColumnsOrMasterColumns(Long programId); boolean isFormulaValidationRequired(Program program);  }