1
|
/**
|
2
|
* Copyright (C) 2017 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
|
*/
|
9
|
package eu.etaxonomy.cdm.vaadin.util.converter;
|
10
|
|
11
|
import static org.junit.Assert.assertNotNull;
|
12
|
|
13
|
import java.util.ArrayList;
|
14
|
import java.util.List;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
import org.junit.Test;
|
18
|
|
19
|
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
|
20
|
import eu.etaxonomy.cdm.model.name.Rank;
|
21
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
|
22
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
23
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
24
|
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
|
25
|
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
|
26
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
27
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
28
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
29
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
30
|
import eu.etaxonomy.cdm.vaadin.CdmVaadinBaseTest;
|
31
|
|
32
|
/**
|
33
|
* @author a.kohlbecker
|
34
|
* @since Mar 10, 2017
|
35
|
*
|
36
|
*/
|
37
|
public class TypeDesignationConverterTest extends CdmVaadinBaseTest{
|
38
|
|
39
|
|
40
|
@Test
|
41
|
public void test1(){
|
42
|
|
43
|
NameTypeDesignation ntd = NameTypeDesignation.NewInstance();
|
44
|
TaxonName typeName = TaxonNameFactory.NewBacterialInstance(Rank.SPECIES());
|
45
|
typeName.setTitleCache("Prionus coriatius L.", true);
|
46
|
ntd.setTypeName(typeName);
|
47
|
Reference citation = ReferenceFactory.newGeneric();
|
48
|
citation.setTitleCache("Species Platarum", true);
|
49
|
ntd.setCitation(citation);
|
50
|
|
51
|
SpecimenTypeDesignation std = SpecimenTypeDesignation.NewInstance();
|
52
|
DerivedUnit specimen = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
|
53
|
specimen.setTitleCache("OHA", true);
|
54
|
std.setTypeSpecimen(specimen);
|
55
|
std.setTypeStatus(SpecimenTypeDesignationStatus.HOLOTYPE());
|
56
|
|
57
|
List<TypeDesignationBase> tds = new ArrayList<>();
|
58
|
tds.add(ntd);
|
59
|
tds.add(std);
|
60
|
|
61
|
String result = new TypeDesignationConverter(tds, null).buildString().print();
|
62
|
Logger.getLogger(this.getClass()).debug(result);
|
63
|
assertNotNull(result);
|
64
|
}
|
65
|
|
66
|
}
|