Revision 7abafd61
Added by Andreas Müller almost 8 years ago
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/FloraCubaCondensedDistributionComposerTest.java | ||
---|---|---|
13 | 13 |
import java.util.Set; |
14 | 14 |
import java.util.UUID; |
15 | 15 |
|
16 |
import org.junit.Assert; |
|
16 | 17 |
import org.junit.Before; |
17 | 18 |
import org.junit.BeforeClass; |
18 | 19 |
import org.junit.Test; |
... | ... | |
61 | 62 |
DefaultTermInitializer initializer = new DefaultTermInitializer(); |
62 | 63 |
initializer.initialize(); |
63 | 64 |
|
65 |
defineSymbolsForExistingTerms(); |
|
64 | 66 |
statusVoc = OrderedTermVocabulary.NewInstance(TermType.PresenceAbsenceTerm); |
65 |
statusVoc.addTerm(makeStatusTerm("occasionally cultivated","(c)",false, uuidStatusOccasionallyCultivated)); |
|
66 |
statusVoc.addTerm(makeStatusTerm("not native but possibly naturalised","p",false,uuidStatusNotNativButNaturalised)); |
|
67 |
statusVoc.addTerm(makeStatusTerm("doubtfully native: reported in error","-d",false,uuidStatusDoubtfullyNativeError)); |
|
67 |
statusVoc.addTerm(makeStatusTerm("occasionally cultivated","oc","(c)",false, uuidStatusOccasionallyCultivated));
|
|
68 |
statusVoc.addTerm(makeStatusTerm("not native but possibly naturalised","p","p", false,uuidStatusNotNativButNaturalised));
|
|
69 |
statusVoc.addTerm(makeStatusTerm("doubtfully native: reported in error","df","-d",false,uuidStatusDoubtfullyNativeError));
|
|
68 | 70 |
|
69 | 71 |
makeAreas(); |
70 | 72 |
} |
71 | 73 |
|
72 | 74 |
|
75 |
/** |
|
76 |
* |
|
77 |
*/ |
|
78 |
private static void defineSymbolsForExistingTerms() { |
|
79 |
PresenceAbsenceTerm.ENDEMIC_FOR_THE_RELEVANT_AREA().setSymbol("\u25CF"); |
|
80 |
PresenceAbsenceTerm.NATIVE().setSymbol(""); |
|
81 |
PresenceAbsenceTerm.NATIVE_PRESENCE_QUESTIONABLE().setSymbol("?"); |
|
82 |
PresenceAbsenceTerm.PRESENT_DOUBTFULLY().setSymbol("?"); |
|
83 |
PresenceAbsenceTerm.NATIVE_DOUBTFULLY_NATIVE().setSymbol("d"); |
|
84 |
PresenceAbsenceTerm.NATIVE_REPORTED_IN_ERROR().setSymbol("-"); |
|
85 |
PresenceAbsenceTerm.REPORTED_IN_ERROR().setSymbol("-"); |
|
86 |
PresenceAbsenceTerm.INTRODUCED_ADVENTITIOUS().setSymbol("a"); |
|
87 |
PresenceAbsenceTerm.CULTIVATED().setSymbol("c"); |
|
88 |
PresenceAbsenceTerm.NATURALISED().setSymbol("n"); |
|
89 |
PresenceAbsenceTerm.CULTIVATED_PRESENCE_QUESTIONABLE().setSymbol("?c"); |
|
90 |
PresenceAbsenceTerm.CULTIVATED_REPORTED_IN_ERROR().setSymbol("-c"); |
|
91 |
PresenceAbsenceTerm.NATIVE().setSymbol(""); |
|
92 |
//Cuba specific |
|
93 |
// statusSymbols.put(UUID.fromString("936c3f9a-6099-4322-9792-0a72c6c2ce25"), "(c)"); |
|
94 |
// //endemic, doubtfully present |
|
95 |
// statusSymbols.put(UUID.fromString("5f954f08-267a-4928-b073-12328f74c187"), "?e"); |
|
96 |
// //non-native and doubtfully naturalised |
|
97 |
// statusSymbols.put(UUID.fromString("a1e26234-831e-4190-9fe3-011aca09ddba"), "p"); |
|
98 |
// //rare casual |
|
99 |
// statusSymbols.put(UUID.fromString("8914ce0d-7d31-4c88-8317-985f2b3a493b"), "(a)"); |
|
100 |
// //?non-native and doubtfully naturalised |
|
101 |
// statusSymbols.put(UUID.fromString("9e0b413b-5a68-4e5b-91f2-227b4f832466"), "?p"); |
|
102 |
// //?adventive (casual) alien |
|
103 |
// statusSymbols.put(UUID.fromString("c42ca644-1773-4230-a2ee-328a5d4a21ab"), "?a"); |
|
104 |
// //endemic, reported in error |
|
105 |
// statusSymbols.put(UUID.fromString("679b215d-c231-4ee2-ae12-3ffc3dd528ad"), "-e"); |
|
106 |
// //naturalised, reported in error |
|
107 |
// statusSymbols.put(UUID.fromString("8d918a37-3add-4e1c-a233-c37dbee209aa"), "-n"); |
|
108 |
// //non-native and doubtfully naturalised, reported in error |
|
109 |
// statusSymbols.put(UUID.fromString("b9153d90-9e31-465a-a28c-79077a8ed4c2"), "-p"); |
|
110 |
// //adventive alien , reported in error |
|
111 |
// statusSymbols.put(UUID.fromString("9b910b7b-43e3-4260-961c-6063b11cb7dc"), "-a"); |
|
112 |
// //doubtfully native: reported in error |
|
113 |
// statusSymbols.put(UUID.fromString("71b72e24-c2b6-44a5-bdab-39f083bf0f06"), "-d"); |
|
114 |
} |
|
115 |
|
|
116 |
|
|
73 | 117 |
/** |
74 | 118 |
* @throws java.lang.Exception |
75 | 119 |
*/ |
... | ... | |
97 | 141 |
|
98 | 142 |
CondensedDistribution condensedDistribution = composer.createCondensedDistribution(filteredDistributions, null); |
99 | 143 |
String condensedString = condensedDistribution.toString(); |
100 |
System.out.println(condensedString); |
|
144 |
|
|
145 |
Assert.assertEquals("Condensed string for Cuba differs", "nCu((c)CuE(nHo)) Bah ?VM ", condensedString); |
|
146 |
|
|
101 | 147 |
|
102 | 148 |
//TODO work in progress |
103 | 149 |
} |
... | ... | |
330 | 376 |
} |
331 | 377 |
|
332 | 378 |
|
333 |
private static PresenceAbsenceTerm makeStatusTerm(String desc, String abbrev, boolean absent, UUID uuid) { |
|
379 |
private static PresenceAbsenceTerm makeStatusTerm(String desc, String abbrev, String symbol, boolean absent, UUID uuid) {
|
|
334 | 380 |
PresenceAbsenceTerm result = PresenceAbsenceTerm.NewPresenceInstance(desc, desc, abbrev); |
335 | 381 |
result.setAbsenceTerm(absent); |
336 | 382 |
result.setUuid(uuid); |
383 |
result.setSymbol(symbol); |
|
337 | 384 |
return result; |
338 | 385 |
} |
339 | 386 |
|
Also available in: Unified diff
Update Cuba Condensed String handling