public final void testThreshold_InvalidDescription() { MaintenanceDocumentBase doc = getMaintenanceDocument(ThresholdFixture.CHARTCODE); doc.getDocumentHeader().setDocumentDescription(null); assertFalse(thresholdRule.processSaveDocument(doc)); assertTrue(GlobalVariables.getMessageMap().hasErrors()); assertTrue( GlobalVariables.getMessageMap() .getErrorMessages() .containsKey("document.documentHeader.documentDescription")); }
private MaintenanceDocumentBase getMaintenanceDocument(ThresholdFixture thresholdFixture) { MaintenanceDocumentBase doc = null; try { doc = (MaintenanceDocumentBase) SpringContext.getBean(DocumentService.class) .getNewDocument(PurapConstants.RECEIVING_THRESHOLD_DOCUMENT_TYPE); } catch (WorkflowException e) { throw new RuntimeException("Document creation failed."); } doc.getDocumentHeader().setDocumentDescription("JUnit test document"); Maintainable maintainableDoc = doc.getNewMaintainableObject(); maintainableDoc.setBusinessObject(thresholdFixture.getThresholdBO()); return doc; }