1
|
/**
|
2
|
* Copyright (C) 2016 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.ext.geo;
|
10
|
|
11
|
import java.util.ArrayList;
|
12
|
import java.util.HashSet;
|
13
|
import java.util.List;
|
14
|
import java.util.Set;
|
15
|
|
16
|
import org.junit.Assert;
|
17
|
import org.junit.Ignore;
|
18
|
import org.junit.Test;
|
19
|
|
20
|
import eu.etaxonomy.cdm.api.service.dto.CondensedDistribution;
|
21
|
import eu.etaxonomy.cdm.model.common.Language;
|
22
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
23
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
24
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
25
|
import eu.etaxonomy.cdm.test.TermTestBase;
|
26
|
|
27
|
/**
|
28
|
* @author a.mueller
|
29
|
\* @since 15.06.2016
|
30
|
*
|
31
|
*/
|
32
|
@Ignore
|
33
|
public class EuroPlusMedCondensedDistributionComposerTest extends TermTestBase {
|
34
|
|
35
|
|
36
|
@Test
|
37
|
public void testGetCondensedDistribution() {
|
38
|
|
39
|
NamedArea germany = NamedArea.NewInstance("Germany", "", "GER");
|
40
|
NamedArea berlin = NamedArea.NewInstance("Berlin", "", "GER(B)");
|
41
|
berlin.setPartOf(germany);
|
42
|
NamedArea bawue = NamedArea.NewInstance("Baden Württemberg", "", "GER(BW)");
|
43
|
bawue.setPartOf(germany);
|
44
|
NamedArea france = NamedArea.NewInstance("France", "", "FR");
|
45
|
NamedArea ileDeFrance = NamedArea.NewInstance("Ile-de-France", "", "FR(J)");
|
46
|
ileDeFrance.setPartOf(france);
|
47
|
NamedArea italy = NamedArea.NewInstance("Italy", "", "IT");
|
48
|
NamedArea spain = NamedArea.NewInstance("Spain", "", "S");
|
49
|
|
50
|
Set<Distribution> distributions = new HashSet<Distribution>();
|
51
|
distributions.add(Distribution.NewInstance(germany, PresenceAbsenceTerm.NATIVE()));
|
52
|
distributions.add(Distribution.NewInstance(bawue, PresenceAbsenceTerm.NATIVE()));
|
53
|
distributions.add(Distribution.NewInstance(berlin, PresenceAbsenceTerm.NATIVE()));
|
54
|
distributions.add(Distribution.NewInstance(italy, PresenceAbsenceTerm.PRESENT_DOUBTFULLY()));
|
55
|
|
56
|
distributions.add(Distribution.NewInstance(france, PresenceAbsenceTerm.CASUAL()));
|
57
|
distributions.add(Distribution.NewInstance(ileDeFrance, PresenceAbsenceTerm.CULTIVATED()));
|
58
|
distributions.add(Distribution.NewInstance(spain, PresenceAbsenceTerm.NATURALISED()));
|
59
|
|
60
|
List<Language> languages = new ArrayList<Language>();
|
61
|
|
62
|
CondensedDistribution condensedDistribution = EditGeoServiceUtilities.getCondensedDistribution(
|
63
|
distributions,
|
64
|
CondensedDistributionRecipe.EuroPlusMed,
|
65
|
languages);
|
66
|
|
67
|
Assert.assertEquals("GER(B BW) ?IT [aFR cFR(J) nS]", condensedDistribution.toString());
|
68
|
}
|
69
|
|
70
|
}
|