1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.actions;
18
19 import org.junit.Test;
20 import org.kuali.rice.kew.dto.NetworkIdDTO;
21 import org.kuali.rice.kew.exception.WorkflowException;
22 import org.kuali.rice.kew.service.KEWServiceLocator;
23 import org.kuali.rice.kew.service.WorkflowDocument;
24 import org.kuali.rice.kew.test.KEWTestCase;
25
26
27 public class CreateDocumentTest extends KEWTestCase {
28
29 @Override
30 protected void loadTestData() throws Exception {
31 loadXmlFile("ActionsConfig.xml");
32 }
33
34
35
36
37 @Test public void testCreateNonExistentDocumentType() throws Exception {
38 WorkflowDocument document = new WorkflowDocument(getPrincipalIdForName("ewestfal"), "flim-flam-flooey");
39 try {
40 document.getRouteHeaderId();
41 fail("A workflow exception should have been thrown.");
42 } catch (WorkflowException e) {
43 e.printStackTrace();
44 }
45 }
46
47
48
49
50 @Test public void testCreateNonRoutableDocumentType() throws Exception {
51
52
53 WorkflowDocument document = new WorkflowDocument(getPrincipalIdForName("ewestfal"), "BlanketApproveTest");
54 try {
55 document.getRouteHeaderId();
56 fail("A workflow exception should have been thrown.");
57 } catch (IllegalArgumentException e) {
58 e.printStackTrace();
59 }
60 }
61
62
63
64
65 @Test public void testCreateInactiveDocumentType() throws Exception {
66
67
68 WorkflowDocument document = new WorkflowDocument(getPrincipalIdForName("ewestfal"), "CreatedDocumentInactive");
69 try {
70 document.getRouteHeaderId();
71 fail("A workflow exception should have been thrown.");
72 } catch (WorkflowException e) {
73 e.printStackTrace();
74 }
75 }
76
77 protected String getPrincipalIdForName(String principalName) {
78 return KEWServiceLocator.getIdentityHelperService()
79 .getIdForPrincipalName(principalName);
80 }
81 }