164 |
164 |
|
165 |
165 |
@Test
|
166 |
166 |
public void testGetTitleCache() {
|
167 |
|
String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), sand dunes, 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: 8909756); flowers blue.";
|
|
167 |
String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), sand dunes, 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: 8909756); flowers blue";
|
168 |
168 |
addEcology(fieldUnit, ecology);
|
169 |
169 |
addPlantDescription(fieldUnit, plantDescription);
|
170 |
170 |
collection.setCode("B");
|
... | ... | |
178 |
178 |
|
179 |
179 |
@Test
|
180 |
180 |
public void testGetTitleCacheWithEtAl() {
|
181 |
|
String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), sand dunes, 3 May 2005, Kilian 5678, A. Muller, Kohlbecker & al.; Greuter, Pl. Dahlem. 456 (B: 8909756); flowers blue.";
|
|
181 |
String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), sand dunes, 3 May 2005, Kilian 5678, A. Muller, Kohlbecker & al.; Greuter, Pl. Dahlem. 456 (B: 8909756); flowers blue";
|
182 |
182 |
collector.setHasMoreMembers(true);
|
183 |
183 |
addEcology(fieldUnit, ecology);
|
184 |
184 |
addPlantDescription(fieldUnit, plantDescription);
|
... | ... | |
192 |
192 |
//Note: Collection Code B might be deduplicated in future
|
193 |
193 |
addPlantDescription(fieldUnit, plantDescription);
|
194 |
194 |
collection.setCode("B");
|
195 |
|
String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: 8909756); flowers blue.";
|
|
195 |
String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: 8909756); flowers blue";
|
196 |
196 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
197 |
197 |
|
198 |
198 |
specimen.setAccessionNumber(null);
|
199 |
|
correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: B12345678); flowers blue.";
|
|
199 |
correctCache = correctCache.replace("B: 8909756", "B: B12345678");
|
200 |
200 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
201 |
201 |
|
202 |
202 |
specimen.setBarcode(null);
|
203 |
|
correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: UU879873590); flowers blue.";
|
|
203 |
correctCache = correctCache.replace("B: B12345678", "B: UU879873590");
|
204 |
204 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
205 |
205 |
|
206 |
206 |
//no deduplication of collection code in accession number according to #6865
|
207 |
207 |
specimen.setAccessionNumber("B 12345");
|
208 |
|
correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10\u00B034'1.2\"N, 12\u00B018'E (WGS84), 3 May 2005, Kilian 5678, A. Muller & Kohlbecker; Greuter, Pl. Dahlem. 456 (B: B 12345); flowers blue.";
|
|
208 |
correctCache = correctCache.replace("B: UU879873590", "B: B 12345");
|
209 |
209 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
210 |
210 |
specimen.setAccessionNumber("B12345");
|
211 |
211 |
correctCache = correctCache.replace("B 12345", "B12345");
|
... | ... | |
213 |
213 |
|
214 |
214 |
//but deduplication should take place if explicitly set
|
215 |
215 |
specimen.setAccessionNumber("B 12345");
|
216 |
|
specimen.setCacheStrategy(DerivedUnitDefaultCacheStrategy.NewInstance(false, true, true));
|
|
216 |
specimen.setCacheStrategy(DerivedUnitDefaultCacheStrategy.NewInstance(false, false, true));
|
217 |
217 |
correctCache = correctCache.replace("B: B12345", "B: 12345");
|
218 |
218 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
|
219 |
|
|
220 |
//with trailing full stop #9849
|
|
221 |
specimen.setCacheStrategy(DerivedUnitDefaultCacheStrategy.NewInstance(false, true, true));
|
|
222 |
correctCache = correctCache + ".";
|
|
223 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
|
224 |
|
|
225 |
//skip field unit
|
|
226 |
specimen.setCacheStrategy(DerivedUnitDefaultCacheStrategy.NewInstance(true, false, false));
|
|
227 |
correctCache = "Greuter, Pl. Dahlem. 456 (B: B 12345)";
|
|
228 |
Assert.assertEquals(correctCache, specimen.getTitleCache());
|
|
229 |
|
219 |
230 |
}
|
220 |
231 |
|
221 |
232 |
@Test
|
... | ... | |
230 |
241 |
Assert.assertEquals("DerivedUnit#0<"+specimen.getUuid()+">", specimen.getTitleCache());
|
231 |
242 |
|
232 |
243 |
specimen.setBarcode("B996633");
|
233 |
|
Assert.assertEquals("(B996633).", specimen.getTitleCache()); //maybe brackets and/or the full stop will be removed in future
|
|
244 |
Assert.assertEquals("(B996633)", specimen.getTitleCache()); //maybe brackets will be removed in future
|
234 |
245 |
|
235 |
246 |
}
|
236 |
247 |
|
ref #9849 remove trailing dot from DerivedUnitDefaultCacheStrategy