1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.workflow.service;
17
18
19 import static org.junit.Assert.assertFalse;
20 import static org.junit.Assert.assertTrue;
21
22 import org.junit.Test;
23 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
24 import org.kuali.rice.kew.api.KewApiServiceLocator;
25 import org.kuali.test.KRADTestCase;
26
27
28
29
30
31 public class WorkflowInfoServiceTest extends KRADTestCase {
32
33 @Test public void testRouteHeaderExists_NullId() throws IllegalArgumentException {
34 boolean errorThrown = false;
35 try {
36 KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist(null);
37 } catch (RiceIllegalArgumentException e) {
38 errorThrown = true;
39 }
40 assertTrue("An error should have been thrown.", errorThrown);
41 }
42
43 @Test public void testRouteHeaderExists_NegativeId() {
44 boolean errorThrown = false;
45 boolean result = true;
46 try {
47 result = KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist("-10");
48 } catch (Exception e) {
49 errorThrown = true;
50 }
51 assertFalse("An error should not have been thrown.", errorThrown);
52 assertFalse("The routeHeader should never exist for a negative documentId.", result);
53 }
54
55 @Test public void testRouteHeaderExists_KnownBadZeroId() {
56 boolean errorThrown = false;
57 boolean result = true;
58 try {
59 result = KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist("0");
60 }
61 catch (Exception e) {
62 errorThrown = true;
63 }
64 assertFalse("An error should not have been thrown.", errorThrown);
65 assertFalse("The routeHeader should never exist for a documentId of 0.", result);
66 }
67
68 @Test public void testRouteHeaderExists_KnownGood() {
69
70
71 assertTrue("This has been checked with a known-good id in the DB at this time.", true);
72 }
73
74 }