Revision 2243
Added by sgarg over 20 years ago
test/edu/ucsb/nceas/metacattest/SubTreeTest.java | ||
---|---|---|
45 | 45 |
public class SubTreeTest extends TestCase |
46 | 46 |
{ |
47 | 47 |
private SubTree tree = null; |
48 |
|
|
48 |
|
|
49 | 49 |
/** |
50 | 50 |
* Constructor to build the test |
51 | 51 |
* |
... | ... | |
67 | 67 |
super(name); |
68 | 68 |
this.tree = myTree; |
69 | 69 |
} |
70 |
|
|
70 |
|
|
71 | 71 |
/** |
72 | 72 |
* Establish a testing framework by initializing appropriate objects |
73 | 73 |
*/ |
74 | 74 |
public void setUp() |
75 | 75 |
{ |
76 |
|
|
76 |
|
|
77 | 77 |
} |
78 | 78 |
|
79 | 79 |
/** |
... | ... | |
102 | 102 |
MetaCatUtil.debugMessage("Error in ReplicationServerList() to get" + |
103 | 103 |
" DBConnection pool"+e.getMessage(), 30); |
104 | 104 |
}//catch |
105 |
|
|
105 |
|
|
106 | 106 |
TestSuite suite = new TestSuite(); |
107 |
|
|
107 |
|
|
108 | 108 |
try |
109 | 109 |
{ |
110 |
|
|
110 |
|
|
111 | 111 |
//create a new subtree |
112 | 112 |
SubTree subTree = new SubTree("eml.349", "distribution1", 118214, 118223); |
113 |
|
|
113 |
|
|
114 | 114 |
//Doing test test cases |
115 | 115 |
suite.addTest(new SubTreeTest("initialize")); |
116 | 116 |
System.out.println("before adding testGetSubTreeNodeStack() into suite"); |
117 | 117 |
suite.addTest(new SubTreeTest("testGetSubTreeNodeStack", subTree)); |
118 | 118 |
System.out.println("here!!"); |
119 |
|
|
120 |
|
|
119 |
|
|
120 |
|
|
121 | 121 |
}//try |
122 | 122 |
catch (Exception e) |
123 | 123 |
{ |
... | ... | |
126 | 126 |
}//catch |
127 | 127 |
return suite; |
128 | 128 |
} |
129 |
|
|
130 | 129 |
|
131 | 130 |
|
131 |
|
|
132 | 132 |
/** |
133 | 133 |
* Run an initial test that always passes to check that the test |
134 | 134 |
* harness is working. |
... | ... | |
140 | 140 |
} |
141 | 141 |
|
142 | 142 |
/** |
143 |
* Test the method getSubTreeNodeStack
|
|
143 |
* Test the method getSubTreeNodeStack |
|
144 | 144 |
*/ |
145 | 145 |
public void testGetSubTreeNodeStack() |
146 | 146 |
{ |
147 |
Stack nodeStack = tree.getSubTreeNodeStack(); |
|
147 |
Stack nodeStack = null; |
|
148 |
try{ |
|
149 |
nodeStack = tree.getSubTreeNodeStack(); |
|
150 |
}//try |
|
151 |
catch (Exception e) |
|
152 |
{ |
|
153 |
MetaCatUtil.debugMessage("Error in SubTreeTest.suite: "+ |
|
154 |
e.getMessage(), 10); |
|
155 |
}//catch |
|
156 |
|
|
148 | 157 |
while (!nodeStack.empty()) |
149 | 158 |
{ |
150 | 159 |
NodeRecord node =(NodeRecord)nodeStack.pop(); |
... | ... | |
164 | 173 |
} |
165 | 174 |
} |
166 | 175 |
assertTrue(1 == 1); |
167 |
|
|
168 |
} |
|
169 | 176 |
|
170 |
|
|
177 |
} |
|
178 |
|
|
179 |
|
|
171 | 180 |
}//ReplicationServerListTest |
Also available in: Unified diff
Changed SubTreeTest.java to handle the exception that is thrown by SubTree.java now.