Project

General

Profile

« Previous | Next » 

Revision c693e3b1

Added by Patrick Plitzner about 5 years ago

ref #6794 Add generics to FeatureNode and FeatureTree

View differences:

cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/jaxb/FeatureTest.java
1 1
/**
2 2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
22 22
import eu.etaxonomy.cdm.model.description.FeatureTree;
23 23

  
24 24
public class FeatureTest {
25
		
25

  
26 26
	    private String resource = "/eu/etaxonomy/cdm/io/jaxb/FeatureTest.xml";
27
	    
27

  
28 28
	    @Test
29 29
	    public void testUnmarshalFeatureTree() throws Exception {
30 30
	        CdmDocumentBuilder cdmDocumentBuilder = new CdmDocumentBuilder();
31 31
	        URI uri = new URI(URIEncoder.encode(this.getClass().getResource(resource).toString()));
32 32
	        DataSet dataSet = cdmDocumentBuilder.unmarshal(DataSet.class, new InputStreamReader(this.getClass().getResourceAsStream(resource)),uri.toString());
33
			
34
			FeatureTree featureTree = (FeatureTree)dataSet.getFeatureTrees().get(0);
33

  
34
			FeatureTree featureTree = dataSet.getFeatureTrees().get(0);
35 35
			Feature feature = (Feature)dataSet.getTerms().get(1);
36
			
36

  
37 37
			assertNotNull("FeatureTree must not be null",featureTree);
38 38
			assertNotNull("Feature must not be null",feature);
39
			
39

  
40 40
			assertNotNull("FeatureTree.root must not be null",featureTree.getRoot());
41 41
			FeatureNode featureNode = featureTree.getRoot();
42
			assertNotNull("FeatureNode.feature must not be null",featureNode.getFeature());
43
			assertEquals("FeatureNode.feature must equal Feature",feature,featureNode.getFeature());
44
			
42
			assertNotNull("FeatureNode.feature must not be null",featureNode.getTerm());
43
			assertEquals("FeatureNode.feature must equal Feature",feature,featureNode.getTerm());
44

  
45 45
			assertNotNull("FeatureNode.children must not be null",featureNode.getChildNodes());
46 46
			assertFalse("FeatureNode.children must not be empty",featureNode.getChildNodes().isEmpty());
47 47
			assertEquals("FeatureNode.children must have 4 child nodes",4,featureNode.getChildNodes().size());
48
			
48

  
49 49
	    }
50 50
}

Also available in: Unified diff