@Test public void shouldRetrieveAllColumnsFromMasterTable() throws Exception { when(programRnrColumnMapper.isRnrTemplateDefined(EXISTING_PROGRAM_ID)).thenReturn(false); when(programRnrColumnMapper.fetchAllMasterRnRColumns()).thenReturn(rnrColumns); List<RnrColumn> result = rnrRepository.fetchRnrTemplateColumnsOrMasterColumns(EXISTING_PROGRAM_ID); assertThat(result, is(rnrColumns)); verify(programRnrColumnMapper).fetchAllMasterRnRColumns(); }
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);  }