001    /**
002     * Copyright 2005-2014 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kns.workflow.service;
017    
018    
019    import  org.junit.Assert;
020    
021    import org.junit.Test;
022    import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
023    import org.kuali.rice.kew.api.KewApiServiceLocator;
024    import org.kuali.rice.krad.test.KRADTestCase;
025    
026    
027    /**
028     * This class tests the WorkflowUser service.
029     *
030     * @deprecated KNS test class, convert to KRAD equivalent if applicable.
031     */
032    @Deprecated
033    public class WorkflowInfoServiceTest extends KRADTestCase {
034    
035        @Test public void testRouteHeaderExists_NullId() throws IllegalArgumentException {
036            boolean errorThrown = false;
037            try {
038                KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist(null);
039            } catch (RiceIllegalArgumentException e) {
040                errorThrown = true;
041            }
042            Assert.assertTrue("An error should have been thrown.", errorThrown);
043        }
044    
045        @Test public void testRouteHeaderExists_NegativeId() {
046            boolean errorThrown = false;
047            boolean result = true;
048            try {
049                result = KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist("-10");
050            } catch (Exception e) {
051                errorThrown = true;
052            }
053            Assert.assertFalse("An error should not have been thrown.", errorThrown);
054            Assert.assertFalse("The routeHeader should never exist for a negative documentId.", result);
055        }
056        
057        @Test public void testRouteHeaderExists_KnownBadZeroId() {
058            boolean errorThrown = false;
059            boolean result = true;
060            try {
061                result = KewApiServiceLocator.getWorkflowDocumentService().doesDocumentExist("0");
062            }
063            catch (Exception e) {
064                errorThrown = true;
065            }
066            Assert.assertFalse("An error should not have been thrown.", errorThrown);
067            Assert.assertFalse("The routeHeader should never exist for a documentId of 0.", result);
068        }
069    
070        @Test public void testRouteHeaderExists_KnownGood() {
071            // no good way to test this without mocking the workflow service, and in a
072            // way that will be good over the long term, across data changes
073            Assert.assertTrue("This has been checked with a known-good id in the DB at this time.", true);
074        }
075    
076    }