@Test public void testOK() throws Exception { Unit unit = new Unit(); String unitNumber = "BL-RCEN"; unit.setUnitName(unitNumber); unit.setUnitNumber("BL-RCEN"); unit.setParentUnitNumber("IN-IN"); unit.setOrganizationId("00001"); MaintenanceDocument unitmaintenancedocument = newMaintDoc(unit); assertTrue(rule.processCustomApproveDocumentBusinessRules(unitmaintenancedocument)); }
@Test public void testMoveUnitOwnDescendant() throws Exception { Unit unit = new Unit(); unit.setUnitName("IN-IN"); unit.setUnitNumber("IN-IN"); unit.setParentUnitNumber("IN-MED"); unit.setOrganizationId("00001"); MaintenanceDocument unitmaintenancedocument = newMaintDoc(unit); assertFalse(rule.processCustomRouteDocumentBusinessRules(unitmaintenancedocument)); List errors = GlobalVariables.getMessageMap() .getMessages("ddocument.newMaintainableObject.parentUnitNumber"); errors = GlobalVariables.getMessageMap() .getMessages("document.newMaintainableObject.parentUnitNumber"); assertTrue(errors.size() == 1); ErrorMessage message = (ErrorMessage) errors.get(0); assertEquals(message.getErrorKey(), KeyConstants.MOVE_UNIT_OWN_DESCENDANTS); }