Revision d7919b1c
Added by Andreas Müller about 7 years ago
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/jaxb/TaxonNameTest.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 |
*/ |
... | ... | |
18 | 18 |
|
19 | 19 |
import org.junit.Test; |
20 | 20 |
|
21 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
21 |
import eu.etaxonomy.cdm.model.name.IBotanicalName; |
|
22 |
import eu.etaxonomy.cdm.model.name.IZoologicalName; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
23 | 24 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
24 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
|
25 | 25 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
26 | 26 |
|
27 | 27 |
public class TaxonNameTest { |
28 |
|
|
28 |
|
|
29 | 29 |
private String resource = "/eu/etaxonomy/cdm/io/jaxb/TaxonNameTest.xml"; |
30 |
|
|
30 |
|
|
31 | 31 |
@Test |
32 | 32 |
public void testUnmarshalName() throws Exception { |
33 | 33 |
CdmDocumentBuilder cdmDocumentBuilder = new CdmDocumentBuilder(); |
34 | 34 |
URI uri = new URI(URIEncoder.encode(this.getClass().getResource(resource).toString())); |
35 | 35 |
DataSet dataSet = cdmDocumentBuilder.unmarshal(DataSet.class, new InputStreamReader(this.getClass().getResourceAsStream(resource)),uri.toString()); |
36 |
|
|
37 |
BotanicalName botanicalName = (BotanicalName)dataSet.getTaxonomicNames().get(0);
|
|
36 |
|
|
37 |
IBotanicalName botanicalName = dataSet.getTaxonomicNames().get(0);
|
|
38 | 38 |
assertNotNull("BotanicalName must not be null",botanicalName); |
39 | 39 |
DerivedUnit specimen = (DerivedUnit)dataSet.getOccurrences().get(0); |
40 |
|
|
40 |
|
|
41 | 41 |
assertNotNull("BotanicalName.typeDesignations must not be null",botanicalName.getTypeDesignations()); |
42 | 42 |
assertFalse("BotanicalName.typeDesignations must contain TypeDesignation entities", botanicalName.getTypeDesignations().isEmpty()); |
43 |
|
|
43 |
|
|
44 | 44 |
SpecimenTypeDesignation specimenTypeDesignation = (SpecimenTypeDesignation)botanicalName.getTypeDesignations().iterator().next(); |
45 | 45 |
assertNotNull("SpecimenTypeDesignation.typifiedNames must not be null",specimenTypeDesignation.getTypifiedNames()); |
46 | 46 |
assertFalse("SpecimenTypeDesignation.typifiedNames must not be empty",specimenTypeDesignation.getTypifiedNames().isEmpty()); |
47 | 47 |
assertTrue("SpecimenTypeDesignation.typifiedNames must contain BotanicalName",specimenTypeDesignation.getTypifiedNames().contains(botanicalName)); |
48 |
|
|
48 |
|
|
49 | 49 |
assertNotNull("SpecimenTypeDesignation.typeSpecimen must not be null",specimenTypeDesignation.getTypeSpecimen()); |
50 | 50 |
assertEquals("SpecimenTypeDesignation.typeSpecimen must equal Specimen",specimen,specimenTypeDesignation.getTypeSpecimen()); |
51 |
|
|
52 |
ZoologicalName zoologicalName = (ZoologicalName)dataSet.getTaxonomicNames().get(5);
|
|
51 |
|
|
52 |
IZoologicalName zoologicalName = dataSet.getTaxonomicNames().get(5);
|
|
53 | 53 |
assertNotNull("ZoologicalName must not be null",zoologicalName); |
54 |
|
|
54 |
|
|
55 | 55 |
NameTypeDesignation nameTypeDesignation = (NameTypeDesignation)zoologicalName.getTypeDesignations().iterator().next(); |
56 | 56 |
assertNotNull("NameTypeDesignation.typeName must not be null",nameTypeDesignation.getTypeName()); |
57 | 57 |
assertEquals("NameTypeDesignation.typeName must equal ZoologicalName",dataSet.getTaxonomicNames().get(6),nameTypeDesignation.getTypeName()); |
58 |
|
|
58 |
|
|
59 | 59 |
} |
60 | 60 |
} |
Also available in: Unified diff
ref #6362, ref #6365 remove occurrence of NonViralName, BotanicalName, ZoologicalName and others