1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.maintainable;
17
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.kuali.rice.kns.maintenance.KualiMaintainableImpl;
21 import org.kuali.rice.kns.maintenance.Maintainable;
22 import org.kuali.test.KNSTestCase;
23
24
25
26
27 public class KualiMaintainableTest extends KNSTestCase {
28 Maintainable maintainable = null;
29
30
31
32
33 @Before
34 public void setUp() throws Exception {
35 super.setUp();
36 maintainable = new KualiMaintainableImpl();
37 }
38
39
40
41
42
43 @Test
44 public void testGetShowInactiveRecords_Default() throws Exception {
45 boolean displayInactive = maintainable.getShowInactiveRecords("fooCollection");
46 assertTrue("display setting returned true for unset collection", displayInactive);
47 }
48
49
50
51
52 @Test
53 public void testGetShowInactiveRecords_NullParam() throws Exception {
54 boolean failedAsExpected = false;
55 try {
56 maintainable.getShowInactiveRecords(null);
57 }
58 catch (IllegalArgumentException expected) {
59 failedAsExpected = true;
60 }
61
62 assertTrue("exception not thrown for null collection name", failedAsExpected);
63 }
64
65
66
67
68 @Test
69 public void testSetShowInactiveRecords_DisplayCollectionInActive() throws Exception {
70 maintainable.setShowInactiveRecords("collection1", true);
71 assertTrue("state failure on set inactive display to true", maintainable.getShowInactiveRecords("collection1"));
72 }
73
74
75
76
77 @Test
78 public void testSetShowInactiveRecords_NoDisplayCollectionInActive() throws Exception {
79 maintainable.setShowInactiveRecords("collection1", false);
80 assertFalse("state failure on set inactive display to false", maintainable.getShowInactiveRecords("collection1"));
81 }
82
83
84
85
86 @Test
87 public void testSetShowInactiveRecords_DisplaySubCollectionInActive() throws Exception {
88 maintainable.setShowInactiveRecords("collection1.subCollection", true);
89 assertTrue("state failure on set inactive display to true", maintainable.getShowInactiveRecords("collection1.subCollection"));
90 }
91
92
93
94
95 @Test
96 public void testSetShowInactiveRecords_NoDisplaySubCollectionInActive() throws Exception {
97 maintainable.setShowInactiveRecords("collection1.subCollection", false);
98 assertFalse("state failure on set inactive display to false", maintainable.getShowInactiveRecords("collection1.subCollection"));
99 }
100
101
102
103
104 @Test
105 public void testSetShowInactiveRecords_NullParam() throws Exception {
106 boolean failedAsExpected = false;
107 try {
108 maintainable.setShowInactiveRecords(null, true);
109 }
110 catch (IllegalArgumentException expected) {
111 failedAsExpected = true;
112 }
113
114 assertTrue("exception not thrown for null collection name", failedAsExpected);
115 }
116 }