Revision 4dbcb616
Added by Andreas Müller over 3 years ago
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/TermTreeTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
1 | 9 |
package eu.etaxonomy.cdm.model.term; |
2 | 10 |
|
3 | 11 |
import static org.junit.Assert.assertEquals; |
... | ... | |
8 | 16 |
import org.apache.log4j.Logger; |
9 | 17 |
import org.junit.Assert; |
10 | 18 |
import org.junit.Before; |
11 |
import org.junit.BeforeClass; |
|
12 | 19 |
import org.junit.Test; |
13 | 20 |
|
14 | 21 |
import eu.etaxonomy.cdm.model.description.Feature; |
22 |
import eu.etaxonomy.cdm.test.unit.EntityTestBase; |
|
23 |
|
|
24 |
public class TermTreeTest extends EntityTestBase { |
|
15 | 25 |
|
16 |
public class TermTreeTest { |
|
17 | 26 |
@SuppressWarnings("unused") |
18 | 27 |
private static final Logger logger = Logger.getLogger(TermTreeTest.class); |
19 | 28 |
|
... | ... | |
23 | 32 |
private TermNode<Feature> node3; |
24 | 33 |
private TermNode<Feature> node4; |
25 | 34 |
|
26 |
@BeforeClass |
|
27 |
public static void setUpBeforeClass() { |
|
28 |
DefaultTermInitializer vocabularyStore = new DefaultTermInitializer(); |
|
29 |
vocabularyStore.initialize(); |
|
30 |
} |
|
31 |
|
|
32 |
/** |
|
33 |
* @throws java.lang.Exception |
|
34 |
*/ |
|
35 | 35 |
@Before |
36 | 36 |
public void setUp() throws Exception { |
37 | 37 |
testTree = TermTree.NewFeatureInstance(); |
... | ... | |
41 | 41 |
node3 = node2.addChild(Feature.DESCRIPTION()); |
42 | 42 |
node4 = node3.addChild(Feature.DISCUSSION()); |
43 | 43 |
} |
44 |
|
|
44 | 45 |
// @Test |
45 | 46 |
// public void testSetRoot(){ |
46 | 47 |
// testTree.setRoot(node2); |
47 | 48 |
// assertNotNull(testTree.getRoot()); |
48 | 49 |
// assertEquals(testTree.getRoot(), node2); |
49 | 50 |
// } |
51 |
|
|
50 | 52 |
@Test |
51 | 53 |
public void testAddChild(){ |
52 | 54 |
TermNode<Feature> node21 = node1.addChild(Feature.ANATOMY(), 1); |
... | ... | |
69 | 71 |
@Test |
70 | 72 |
public void testClone(){ |
71 | 73 |
TermNode<Feature> node21 = node1.addChild(Feature.ADDITIONAL_PUBLICATION(), 1); |
72 |
TermTree<Feature> clone = (TermTree<Feature>) testTree.clone();
|
|
74 |
TermTree<Feature> clone = testTree.clone(); |
|
73 | 75 |
|
74 | 76 |
assertEquals (clone.getRoot().getTerm(), testTree.getRoot().getTerm()); |
75 | 77 |
assertNotSame(clone.getRoot(), testTree.getRoot()); |
... | ... | |
86 | 88 |
assertEquals(children.get(0).getChildAt(0).getTerm(), node3.getTerm()); |
87 | 89 |
assertNotSame(children.get(0).getChildAt(0), node3); |
88 | 90 |
} |
89 |
} |
|
91 |
} |
Also available in: Unified diff
cleanup and use TermTestBase for model tests