Clover Coverage Report - kns-test 2.0.0-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
39   149   14   5.57
0   92   0.36   7
7     2  
1    
 
  DataDictionaryBuilderTest       Line # 34 39 0% 14 46 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2006-2011 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   
17    package org.kuali.rice.kns.datadictionary;
18   
19    import org.apache.log4j.Logger;
20    import org.junit.After;
21    import org.junit.Before;
22    import org.junit.Test;
23    import org.kuali.test.KNSTestCase;
24   
25    import static org.junit.Assert.assertTrue;
26    import static org.junit.Assert.fail;
27   
28    /**
29    * This class is used to test the DataDictionaryBuilder.
30    *
31    *
32    */
33   
 
34    public class DataDictionaryBuilderTest extends KNSTestCase {
35    protected final Logger LOG = Logger.getLogger(getClass());
36   
37    static final String PACKAGE_CORE_BO = "org/kuali/rice/kns/bo/datadictionary/";
38   
39    static final String PACKAGE_CORE_DOCUMENT = "org/kuali/rice/kns/document/datadictionary/";
40   
41    static final String PACKAGE_KFS = "org/kuali/kfs/datadictionary/";
42   
43    static final String PACKAGE_CHART = "org/kuali/module/chart/datadictionary/";
44   
45    static final String PACKAGE_CG = "org/kuali/module/cg/datadictionary/";
46   
47    static final String PACKAGE_KRA_BUDGET = "org/kuali/module/kra/budget/datadictionary/";
48   
49    static final String PACKAGE_KRA_ROUTINGFORM = "org/kuali/module/kra/routingform/datadictionary/";
50   
51    static final String TESTPACKAGE_INVALID = "org/kuali/rice/kns/datadictionary/test/invalid/";
52   
53    DataDictionary dd = null;
54   
 
55  0 toggle @Before
56    public void setUp() throws Exception {
57  0 super.setUp();
58   
59  0 dd = new DataDictionary();
60    }
61   
 
62  0 toggle @After
63    public void tearDown() throws Exception {
64  0 super.tearDown();
65  0 dd = null;
66    }
67   
 
68  0 toggle @Test
69    public final void testDataDictionaryBuilder_source_invalid() throws Exception {
70  0 boolean failedAsExpected = false;
71   
72  0 try {
73  0 dd.addConfigFileLocation(null);
74    } catch (DataDictionaryException e) {
75  0 failedAsExpected = true;
76    }
77   
78  0 assertTrue(failedAsExpected);
79    }
80   
 
81  0 toggle @Test
82    public final void testDataDictionaryBuilder_source_unknownFile() throws Exception {
83  0 String INPUT_FILE = TESTPACKAGE_INVALID + "foo.xml";
84   
85  0 boolean failedAsExpected = false;
86   
87  0 try {
88  0 dd.addConfigFileLocation(INPUT_FILE);
89    } catch (DataDictionaryException e) {
90  0 failedAsExpected = true;
91    }
92   
93  0 assertTrue(failedAsExpected);
94    }
95   
 
96  0 toggle @Test
97    public final void testDataDictionaryBuilder_source_unknownPackage() throws Exception {
98  0 String UNKNOWN_PACKAGE = TESTPACKAGE_INVALID + "foo/";
99   
100  0 boolean failedAsExpected = false;
101   
102  0 try {
103  0 dd.addConfigFileLocation(UNKNOWN_PACKAGE);
104    } catch (DataDictionaryException e) {
105  0 failedAsExpected = true;
106    }
107   
108  0 assertTrue(failedAsExpected);
109    }
110   
 
111  0 toggle @Test
112    public final void testDataDictionaryBuilder_invalidXml() throws Exception {
113  0 String INPUT_FILE = TESTPACKAGE_INVALID + "InvalidXml.xml";
114   
115  0 boolean failedAsExpected = false;
116   
117  0 try {
118  0 dd.addConfigFileLocation(INPUT_FILE);
119  0 dd.parseDataDictionaryConfigurationFiles( false );
120    } catch (DataDictionaryException e) {
121  0 failedAsExpected = true;
122    } catch (Exception e) {
123  0 LOG.error("Error loading DD files", e);
124  0 fail("Data Dictionary file load failed but with wrong exception type '" + e.getClass().getName() + "'");
125    }
126   
127  0 assertTrue(failedAsExpected);
128    }
129   
 
130  0 toggle @Test
131    public final void testDataDictionaryBuilder_getInvalidDictionary() throws Exception {
132  0 String INPUT_FILE = TESTPACKAGE_INVALID + "InvalidXml.xml";
133   
134  0 boolean failedAsExpected = false;
135   
136  0 try {
137  0 dd.addConfigFileLocation(INPUT_FILE);
138  0 dd.parseDataDictionaryConfigurationFiles( false );
139    } catch (DataDictionaryException e) {
140  0 failedAsExpected = true;
141    } catch (Exception e) {
142  0 LOG.error("Error loading DD files", e);
143  0 fail("Data Dictionary file load failed but with wrong exception type '" + e.getClass().getName() + "'");
144    }
145   
146  0 assertTrue(failedAsExpected);
147    }
148   
149    }