View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.workflow.service;
17  
18  
19  import  org.junit.Assert;
20  
21  import org.junit.Test;
22  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
23  import org.kuali.rice.kew.api.KewApiServiceLocator;
24  import org.kuali.rice.krad.test.KRADTestCase;
25  
26  
27  /**
28   * This class tests the WorkflowUser service.
29   *
30   * @deprecated KNS test class, convert to KRAD equivalent if applicable.
31   */
32  @Deprecated
33  public class WorkflowInfoServiceTest extends KRADTestCase {
34  
35      @Test public void testRouteHeaderExists_NullId() throws IllegalArgumentException {
36          boolean errorThrown = false;
37          try {
38              KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist(null);
39          } catch (RiceIllegalArgumentException e) {
40              errorThrown = true;
41          }
42          Assert.assertTrue("An error should have been thrown.", errorThrown);
43      }
44  
45      @Test public void testRouteHeaderExists_NegativeId() {
46          boolean errorThrown = false;
47          boolean result = true;
48          try {
49              result = KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist("-10");
50          } catch (Exception e) {
51              errorThrown = true;
52          }
53          Assert.assertFalse("An error should not have been thrown.", errorThrown);
54          Assert.assertFalse("The routeHeader should never exist for a negative documentId.", result);
55      }
56      
57      @Test public void testRouteHeaderExists_KnownBadZeroId() {
58          boolean errorThrown = false;
59          boolean result = true;
60          try {
61              result = KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist("0");
62          }
63          catch (Exception e) {
64              errorThrown = true;
65          }
66          Assert.assertFalse("An error should not have been thrown.", errorThrown);
67          Assert.assertFalse("The routeHeader should never exist for a documentId of 0.", result);
68      }
69  
70      @Test public void testRouteHeaderExists_KnownGood() {
71          // no good way to test this without mocking the workflow service, and in a
72          // way that will be good over the long term, across data changes
73          Assert.assertTrue("This has been checked with a known-good id in the DB at this time.", true);
74      }
75  
76  }