26 |
26 |
|
27 |
27 |
import org.apache.commons.lang.StringUtils;
|
28 |
28 |
import org.apache.log4j.Logger;
|
29 |
|
import org.junit.After;
|
30 |
|
import org.junit.AfterClass;
|
31 |
29 |
import org.junit.Assert;
|
32 |
30 |
import org.junit.Before;
|
33 |
|
import org.junit.BeforeClass;
|
34 |
31 |
import org.junit.Test;
|
35 |
32 |
import org.springframework.beans.BeanUtils;
|
36 |
33 |
|
... | ... | |
47 |
44 |
/**
|
48 |
45 |
* @author a.mueller
|
49 |
46 |
* @since 01.04.2009
|
50 |
|
* @version 1.0
|
51 |
47 |
*/
|
52 |
48 |
public class ClassificationTest {
|
53 |
49 |
private static final Logger logger = Logger.getLogger(ClassificationTest.class);
|
... | ... | |
74 |
70 |
private static Reference ref3;
|
75 |
71 |
//private ReferenceFactory refFactory;
|
76 |
72 |
|
77 |
|
|
78 |
|
|
79 |
|
/**
|
80 |
|
* @throws java.lang.Exception
|
81 |
|
*/
|
82 |
|
@BeforeClass
|
83 |
|
public static void setUpBeforeClass() throws Exception {
|
84 |
|
}
|
85 |
|
|
86 |
|
/**
|
87 |
|
* @throws java.lang.Exception
|
88 |
|
*/
|
89 |
|
@AfterClass
|
90 |
|
public static void tearDownAfterClass() throws Exception {
|
91 |
|
}
|
92 |
|
|
93 |
73 |
/**
|
94 |
74 |
* @throws java.lang.Exception
|
95 |
75 |
*/
|
... | ... | |
115 |
95 |
//taxonNode1 = new TaxonNode(taxon1, taxonomicView1);
|
116 |
96 |
}
|
117 |
97 |
|
118 |
|
/**
|
119 |
|
* @throws java.lang.Exception
|
120 |
|
*/
|
121 |
|
@After
|
122 |
|
public void tearDown() throws Exception {
|
123 |
|
}
|
124 |
98 |
|
125 |
99 |
//****************************** TESTS *****************************************/
|
126 |
100 |
|
... | ... | |
134 |
108 |
TaxonNode taxonNode1 = classification1.addChildTaxon(taxon1, null, null);
|
135 |
109 |
taxonNode1.setSynonymToBeUsed(synonym);
|
136 |
110 |
|
137 |
|
|
138 |
|
|
139 |
111 |
//test root node
|
140 |
112 |
List<TaxonNode> rootNodes = classification1.getChildNodes();
|
141 |
113 |
assertFalse("List of root nodes should not be empty", rootNodes.isEmpty());
|
... | ... | |
157 |
129 |
|
158 |
130 |
}
|
159 |
131 |
|
160 |
|
/**
|
161 |
|
* Test method for {@link eu.etaxonomy.cdm.model.taxon.Classification#isTaxonInView(eu.etaxonomy.cdm.model.taxon.Taxon)}.
|
162 |
|
*/
|
163 |
132 |
@Test
|
164 |
133 |
public void testIsTaxonInTree() {
|
165 |
134 |
classification1.addChildTaxon(taxon1, null, null);
|
... | ... | |
169 |
138 |
assertFalse(classification1.isTaxonInTree(anyTaxon));
|
170 |
139 |
}
|
171 |
140 |
|
172 |
|
|
173 |
|
/**
|
174 |
|
* Test method for {@link eu.etaxonomy.cdm.model.taxon.Classification#makeRootChildOfOtherNode(eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.model.reference.Reference, java.util.String)}.
|
175 |
|
*/
|
176 |
141 |
@Test
|
177 |
142 |
public void testMakeRootChildOfOtherNode() {
|
178 |
143 |
TaxonNode root1 = classification1.addChildTaxon(taxon1, null, null);
|
... | ... | |
259 |
224 |
|
260 |
225 |
}
|
261 |
226 |
|
262 |
|
/**
|
263 |
|
* Test method for {@link eu.etaxonomy.cdm.model.taxon.Classification#generateTitle()}.
|
264 |
|
*/
|
265 |
227 |
@Test
|
266 |
228 |
public void testGenerateTitle() {
|
267 |
229 |
Classification taxonomicViewLocal = Classification.NewInstance(treeName1);
|
... | ... | |
269 |
231 |
assertEquals(treeName1, taxonomicViewLocal.getTitleCache());
|
270 |
232 |
}
|
271 |
233 |
|
272 |
|
/**
|
273 |
|
* Test method for {@link eu.etaxonomy.cdm.model.taxon.Classification#generateTitle()}.
|
274 |
|
*/
|
275 |
234 |
@Test
|
276 |
235 |
public void play() {
|
277 |
236 |
|
... | ... | |
341 |
300 |
|
342 |
301 |
private Set<CdmBase> getCdmBasesByFieldAndClass(Field field, Class<?> clazz, CdmBase value){
|
343 |
302 |
//FIXME make not dummy but use dao
|
344 |
|
Set<CdmBase> result = new HashSet<CdmBase>();
|
|
303 |
Set<CdmBase> result = new HashSet<>();
|
345 |
304 |
|
346 |
305 |
//genericDao.getCdmBasesByFieldAndClass(clazz, field.getName(), value);
|
347 |
306 |
|
cleanup