@Test public void shouldReturnValidationErrorWhenOnlyRequestedAmountIsSelectedButNotReasonForRequestedAmount() { template.getRnrColumnsMap().put(QUANTITY_REQUESTED, rnrColumn(QUANTITY_REQUESTED, true, USER_INPUT, "Requested Quantity")); template.getRnrColumnsMap().put(REASON_FOR_REQUESTED_QUANTITY, rnrColumn(REASON_FOR_REQUESTED_QUANTITY, false, USER_INPUT, "Requested Quantity Reason")); Map<String, OpenLmisMessage> errors = template.validateToSave(); assertThat(errors.get(QUANTITY_REQUESTED).getCode(), is("error.user.needs.to.enter.requested.quantity.reason")); assertThat(errors.get(QUANTITY_REQUESTED).getParams(), is(new String[]{"Requested Quantity", "Requested Quantity Reason"})); }
public Map<String, OpenLmisMessage> validateToSave() { validateColumnsTobeCheckedIfUserInput(); validateCalculatedColumnHasDependentChecked(STOCK_IN_HAND, QUANTITY_DISPENSED); validateCalculatedColumnHasDependentChecked(QUANTITY_DISPENSED, STOCK_IN_HAND); validateQuantityDispensedAndStockInHandCannotBeCalculatedAtSameTime(); validateQuantityRequested(); return errorMap; }
ProgramRnrTemplate extends Template { public Map<String, OpenLmisMessage> validateToSave() { validateColumnsTobeCheckedIfUserInput(); validateCalculatedColumnHasDependentChecked(STOCK_IN_HAND, QUANTITY_DISPENSED); validateCalculatedColumnHasDependentChecked(QUANTITY_DISPENSED, STOCK_IN_HAND); validateQuantityDispensedAndStockInHandCannotBeCalculatedAtSameTime(); validateQuantityRequested(); return errorMap; } }
ProgramRnrTemplate extends Template { public Map<String, OpenLmisMessage> validateToSave() { validateColumnsTobeCheckedIfUserInput(); validateCalculatedColumnHasDependentChecked(STOCK_IN_HAND, QUANTITY_DISPENSED); validateCalculatedColumnHasDependentChecked(QUANTITY_DISPENSED, STOCK_IN_HAND); validateQuantityDispensedAndStockInHandCannotBeCalculatedAtSameTime(); validateQuantityRequested(); return errorMap; } ProgramRnrTemplate(Long programId, List<? extends Column> rnrColumns);  ProgramRnrTemplate(List<? extends Column> programRnrColumns); }
ProgramRnrTemplate extends Template { public Map<String, OpenLmisMessage> validateToSave() { validateColumnsTobeCheckedIfUserInput(); validateCalculatedColumnHasDependentChecked(STOCK_IN_HAND, QUANTITY_DISPENSED); validateCalculatedColumnHasDependentChecked(QUANTITY_DISPENSED, STOCK_IN_HAND); validateQuantityDispensedAndStockInHandCannotBeCalculatedAtSameTime(); validateQuantityRequested(); return errorMap; } ProgramRnrTemplate(Long programId, List<? extends Column> rnrColumns);  ProgramRnrTemplate(List<? extends Column> programRnrColumns); boolean columnsVisible(String... rnrColumnNames); boolean columnsCalculated(String... rnrColumnNames); boolean columnsUserInput(String... rnrColumnNames); String getRnrColumnLabelFor(String columnName); Map<String, OpenLmisMessage> validateToSave(); List<? extends Column> getPrintableColumns(Boolean fullSupply); }
ProgramRnrTemplate extends Template { public Map<String, OpenLmisMessage> validateToSave() { validateColumnsTobeCheckedIfUserInput(); validateCalculatedColumnHasDependentChecked(STOCK_IN_HAND, QUANTITY_DISPENSED); validateCalculatedColumnHasDependentChecked(QUANTITY_DISPENSED, STOCK_IN_HAND); validateQuantityDispensedAndStockInHandCannotBeCalculatedAtSameTime(); validateQuantityRequested(); return errorMap; } ProgramRnrTemplate(Long programId, List<? extends Column> rnrColumns);  ProgramRnrTemplate(List<? extends Column> programRnrColumns); boolean columnsVisible(String... rnrColumnNames); boolean columnsCalculated(String... rnrColumnNames); boolean columnsUserInput(String... rnrColumnNames); String getRnrColumnLabelFor(String columnName); Map<String, OpenLmisMessage> validateToSave(); List<? extends Column> getPrintableColumns(Boolean fullSupply); static final String STOCK_IN_HAND; static final String REMARKS; static final String QUANTITY_DISPENSED; static final String BEGINNING_BALANCE; static final String QUANTITY_RECEIVED; static final String QUANTITY_APPROVED; static final String LOSSES_AND_ADJUSTMENTS; static final String STOCK_OUT_DAYS; static final String NORMALIZED_CONSUMPTION; static final String QUANTITY_REQUESTED; static final String REASON_FOR_REQUESTED_QUANTITY; static final String NEW_PATIENT_COUNT; static final String COST; static final String PRICE; static final String TOTAL; static final String PRODUCT; static final String DISPENSING_UNIT; static final String PRODUCT_CODE; static final String PACKS_TO_SHIP; static final String SKIPPED; static final String CALCULATED_ORDER_QUANTITY; static final String USER_NEEDS_TO_ENTER_DEPENDENT_FIELD; static final String INTERDEPENDENT_FIELDS_CAN_NOT_BE_CALCULATED; static final String COLUMN_SHOULD_BE_VISIBLE_IF_USER_INPUT; static final String USER_NEED_TO_ENTER_REQUESTED_QUANTITY_REASON; }