public static void saveDocument(Document document, DocumentService documentService)
     throws WorkflowException {
   try {
     documentService.saveDocument(document);
   } catch (ValidationException e) {
     // If the business rule evaluation fails then give us more info for debugging this test.
     fail(e.getMessage() + ", " + GlobalVariables.getMessageMap());
   }
 }
  public static void routeDocument(Document document, DocumentService documentService)
      throws Exception {

    // Verify that the doc isn't yet routed.
    assertFalse(
        "Document should not be already ENROUTE: " + document,
        DocumentStatus.ENROUTE.equals(
            document.getDocumentHeader().getWorkflowDocument().getStatus()));

    // Route the doc.
    try {
      documentService.routeDocument(document, "routing test doc", new Vector());
    } catch (ValidationException e) {
      // If the business rule evaluation fails then give us more info for debugging this test.
      fail(e.getMessage() + ", " + GlobalVariables.getMessageMap());
    }

    // Routing should be configured to go straight to final.
    //
    // assertTrue(FINAL_STATUS.equals(document.getDocumentHeader().getWorkflowDocument().getStatus()));
  }