1
|
/**
|
2
|
* Copyright (C) 2007 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.model.name;
|
10
|
|
11
|
import static org.junit.Assert.assertEquals;
|
12
|
import static org.junit.Assert.assertFalse;
|
13
|
import static org.junit.Assert.assertNotEquals;
|
14
|
import static org.junit.Assert.assertNotNull;
|
15
|
import static org.junit.Assert.assertNotSame;
|
16
|
import static org.junit.Assert.assertNull;
|
17
|
import static org.junit.Assert.assertSame;
|
18
|
import static org.junit.Assert.assertTrue;
|
19
|
|
20
|
import org.apache.log4j.Logger;
|
21
|
import org.junit.Assert;
|
22
|
import org.junit.Before;
|
23
|
import org.junit.Test;
|
24
|
|
25
|
import eu.etaxonomy.cdm.model.common.Language;
|
26
|
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction;
|
27
|
import eu.etaxonomy.cdm.model.description.Feature;
|
28
|
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
|
29
|
import eu.etaxonomy.cdm.model.description.TextData;
|
30
|
import eu.etaxonomy.cdm.model.media.Media;
|
31
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
32
|
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
|
33
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
34
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
35
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
36
|
import eu.etaxonomy.cdm.strategy.parser.TimePeriodParser;
|
37
|
import eu.etaxonomy.cdm.test.unit.EntityTestBase;
|
38
|
|
39
|
/**
|
40
|
* @author a.mueller
|
41
|
* @since 28.06.2008
|
42
|
*/
|
43
|
public class TaxonNameTest extends EntityTestBase {
|
44
|
|
45
|
private static final Logger logger = Logger.getLogger(TaxonNameTest.class);
|
46
|
|
47
|
private TaxonName nameBase1;
|
48
|
private TaxonName nameBase2;
|
49
|
private Reference ref1;
|
50
|
|
51
|
@Before
|
52
|
public void setUp() throws Exception {
|
53
|
nameBase1 = TaxonNameFactory.NewNameInstance(NomenclaturalCode.NonViral, null);
|
54
|
nameBase2 = TaxonNameFactory.NewNameInstance(NomenclaturalCode.NonViral, Rank.GENUS());
|
55
|
ref1 = ReferenceFactory.newBook();
|
56
|
ref1.setTitle("My book");
|
57
|
ref1.setAbbrevTitle("M. bk.");
|
58
|
ref1.setDatePublished(TimePeriodParser.parseStringVerbatim("1988"));
|
59
|
}
|
60
|
|
61
|
/*************************** TESTS ******************************************************/
|
62
|
|
63
|
@Test
|
64
|
public void testSetReferenceWithListener(){
|
65
|
//prepare
|
66
|
nameBase1.setGenusOrUninomial("Abies");
|
67
|
nameBase1.setAuthorshipCache("Auth.");
|
68
|
|
69
|
//before
|
70
|
Assert.assertEquals("Abies Auth.", nameBase1.getFullTitleCache());
|
71
|
|
72
|
//after
|
73
|
//add ref
|
74
|
nameBase1.setNomenclaturalReference(ref1);
|
75
|
Assert.assertEquals("Using transient setNomenclaturalReference should reset the fullTitleCache",
|
76
|
"Abies Auth., M. bk. 1988", nameBase1.getFullTitleCache());
|
77
|
|
78
|
//add detail
|
79
|
nameBase1.setNomenclaturalMicroReference("55");
|
80
|
Assert.assertEquals("Using transient setNomenclaturalMicroReference should reset the fullTitleCache",
|
81
|
"Abies Auth., M. bk.: 55. 1988", nameBase1.getFullTitleCache());
|
82
|
|
83
|
//remove detail
|
84
|
nameBase1.setNomenclaturalMicroReference(null);
|
85
|
Assert.assertEquals("Using the source microcitation setter should reset the fullTitleCache",
|
86
|
"Abies Auth., M. bk. 1988", nameBase1.getFullTitleCache());
|
87
|
|
88
|
//remove ref
|
89
|
nameBase1.setNomenclaturalReference(null);
|
90
|
Assert.assertEquals("Using the source citation setter should reset the fullTitleCache",
|
91
|
"Abies Auth.", nameBase1.getFullTitleCache());
|
92
|
|
93
|
Assert.assertNull("Full emptying the source should remove it from the name (by method checkNullSource)",
|
94
|
nameBase1.getNomenclaturalSource());
|
95
|
|
96
|
//do the same again with setters on source
|
97
|
//after
|
98
|
//add ref
|
99
|
nameBase1.getNomenclaturalSource(true).setCitation(ref1);
|
100
|
Assert.assertEquals("Using transient setNomenclaturalReference should reset the fullTitleCache",
|
101
|
"Abies Auth., M. bk. 1988", nameBase1.getFullTitleCache());
|
102
|
|
103
|
//add detail
|
104
|
nameBase1.getNomenclaturalSource().setCitationMicroReference("55");
|
105
|
Assert.assertEquals("Using transient setNomenclaturalMicroReference should reset the fullTitleCache",
|
106
|
"Abies Auth., M. bk.: 55. 1988", nameBase1.getFullTitleCache());
|
107
|
|
108
|
//remove detail
|
109
|
nameBase1.getNomenclaturalSource().setCitationMicroReference(null);
|
110
|
Assert.assertEquals("Using the source microcitation setter should reset the fullTitleCache",
|
111
|
"Abies Auth., M. bk. 1988", nameBase1.getFullTitleCache());
|
112
|
|
113
|
//remove ref
|
114
|
nameBase1.getNomenclaturalSource().setCitation(null);;
|
115
|
Assert.assertEquals("Using the source citation setter should reset the fullTitleCache",
|
116
|
"Abies Auth.", nameBase1.getFullTitleCache());
|
117
|
|
118
|
Assert.assertNull("Full emptying the source should remove it from the name (by method checkNullSource)",
|
119
|
nameBase1.getNomenclaturalSource());
|
120
|
|
121
|
}
|
122
|
|
123
|
@Test
|
124
|
public void testTaxonName() {
|
125
|
assertNotNull(nameBase1);
|
126
|
}
|
127
|
|
128
|
@Test
|
129
|
public void testTaxonNameRank() {
|
130
|
assertNotNull(nameBase2);
|
131
|
assertEquals(Rank.GENUS(), nameBase2.getRank());
|
132
|
Rank rank = null;
|
133
|
TaxonName testName = TaxonNameFactory.NewNonViralInstance(rank, null);
|
134
|
assertNull(testName.getRank());
|
135
|
}
|
136
|
|
137
|
@Test
|
138
|
public void testTaxonNameHomotypicalGroup() {
|
139
|
HomotypicalGroup hg = HomotypicalGroup.NewInstance();
|
140
|
TaxonName testHG = TaxonNameFactory.NewNonViralInstance(null, hg);
|
141
|
assertSame(hg, testHG.getHomotypicalGroup());
|
142
|
HomotypicalGroup hgNull = null;
|
143
|
TaxonName testHGNull = TaxonNameFactory.NewNonViralInstance(null, hgNull);
|
144
|
assertNotNull(testHGNull.getHomotypicalGroup());
|
145
|
}
|
146
|
|
147
|
@Test
|
148
|
public void testTaxonNameRankHomotypicalGroup() {
|
149
|
Rank rank = Rank.SPECIES();
|
150
|
HomotypicalGroup hg = HomotypicalGroup.NewInstance();
|
151
|
TaxonName testHG = TaxonNameFactory.NewNonViralInstance(rank, hg);
|
152
|
assertSame(rank, testHG.getRank());
|
153
|
assertSame(hg, testHG.getHomotypicalGroup());
|
154
|
|
155
|
Rank rankNull = null;
|
156
|
HomotypicalGroup hgNull = null;
|
157
|
TaxonName testHGNull = TaxonNameFactory.NewNonViralInstance(rankNull, hgNull);
|
158
|
assertEquals(rankNull, testHGNull.getRank());
|
159
|
assertNotNull(testHGNull.getHomotypicalGroup());
|
160
|
}
|
161
|
|
162
|
@Test
|
163
|
public void testAddRelationshipToName() {
|
164
|
logger.warn("not yet implemented");
|
165
|
}
|
166
|
|
167
|
@Test
|
168
|
public void testAddRelationshipFromName() {
|
169
|
logger.warn("not yet implemented");
|
170
|
}
|
171
|
|
172
|
@Test
|
173
|
public void testAddNameRelationship() {
|
174
|
logger.warn("not yet implemented");
|
175
|
}
|
176
|
|
177
|
@Test
|
178
|
public void testRemoveNameRelationship() {
|
179
|
logger.warn("not yet implemented");
|
180
|
}
|
181
|
|
182
|
@Test
|
183
|
public void testAddRelationship() {
|
184
|
logger.warn("not yet implemented");
|
185
|
}
|
186
|
|
187
|
/**
|
188
|
* Test method for {@link eu.etaxonomy.cdm.model.name.TaxonName#getStatus()}.
|
189
|
* and for {@link eu.etaxonomy.cdm.model.name.TaxonName#addStatus(eu.etaxonomy.cdm.model.name.NomenclaturalStatus)}.
|
190
|
* and for {@link eu.etaxonomy.cdm.model.name.TaxonName#removeStatus(eu.etaxonomy.cdm.model.name.NomenclaturalStatus)}.
|
191
|
*/
|
192
|
@Test
|
193
|
public void testGetAddStatus() {
|
194
|
//Empty status set
|
195
|
assertNotNull(nameBase1.getStatus());
|
196
|
assertEquals(0, nameBase1.getStatus().size());
|
197
|
//1 status set
|
198
|
NomenclaturalStatus nomStatus = NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ALTERNATIVE());
|
199
|
nameBase1.addStatus(nomStatus);
|
200
|
assertNotNull(nameBase1.getStatus());
|
201
|
assertEquals(1, nameBase1.getStatus().size());
|
202
|
assertEquals(nomStatus, nameBase1.getStatus().iterator().next());
|
203
|
//2 status set
|
204
|
NomenclaturalStatus nomStatus2 = NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ALTERNATIVE());
|
205
|
nameBase1.addStatus(nomStatus2);
|
206
|
assertEquals(2, nameBase1.getStatus().size());
|
207
|
assertTrue(nameBase1.getStatus().contains(nomStatus2));
|
208
|
//remove
|
209
|
nameBase1.removeStatus(nomStatus);
|
210
|
assertEquals(1, nameBase1.getStatus().size());
|
211
|
assertTrue(nameBase1.getStatus().contains(nomStatus2));
|
212
|
//remove
|
213
|
nameBase1.removeStatus(nomStatus2);
|
214
|
assertEquals(0, nameBase1.getStatus().size());
|
215
|
assertFalse(nameBase1.getStatus().contains(nomStatus2));
|
216
|
}
|
217
|
|
218
|
@Test
|
219
|
public void testIsOriginalCombination() {
|
220
|
logger.warn("not yet implemented");
|
221
|
}
|
222
|
|
223
|
@Test
|
224
|
public void testGetBasionym() {
|
225
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
226
|
TaxonName basionym1 = TaxonNameFactory.NewBotanicalInstance(null);
|
227
|
TaxonName basionym2 = TaxonNameFactory.NewBotanicalInstance(null);
|
228
|
|
229
|
assertEquals(null, name1.getBasionym());
|
230
|
name1.addBasionym(basionym1);
|
231
|
assertEquals(basionym1, name1.getBasionym());
|
232
|
name1.addBasionym(basionym2);
|
233
|
TaxonName oneOfThebasionyms = name1.getBasionym();
|
234
|
assertTrue(oneOfThebasionyms == basionym1 || oneOfThebasionyms == basionym2 );
|
235
|
name1.removeBasionyms();
|
236
|
assertEquals(null, name1.getBasionym());
|
237
|
}
|
238
|
|
239
|
@Test
|
240
|
public void testAddBasionymT() {
|
241
|
assertNotSame(nameBase1.getHomotypicalGroup(), nameBase2.getHomotypicalGroup());
|
242
|
assertFalse(nameBase1.getHomotypicalGroup().equals(nameBase2.getHomotypicalGroup()));
|
243
|
nameBase1.addBasionym(nameBase2);
|
244
|
assertTrue(nameBase1.getHomotypicalGroup().equals(nameBase2.getHomotypicalGroup()));
|
245
|
assertSame(nameBase1.getHomotypicalGroup(), nameBase2.getHomotypicalGroup());
|
246
|
logger.warn("not yet fully implemented");
|
247
|
}
|
248
|
|
249
|
@Test
|
250
|
public void testAddBasionymTaxonNameString() {
|
251
|
logger.warn("not yet implemented");
|
252
|
}
|
253
|
|
254
|
@Test
|
255
|
public void testGetRank() {
|
256
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
257
|
assertNull("Rank shall be null", name1.getRank());
|
258
|
name1.setRank(Rank.SPECIES());
|
259
|
assertNotNull("Rank shall not be null", name1.getRank());
|
260
|
name1.setRank(null);
|
261
|
assertNull("Rank shall be null", name1.getRank());
|
262
|
|
263
|
}
|
264
|
|
265
|
@Test
|
266
|
public void testGetSetNomenclaturalReference() {
|
267
|
INomenclaturalReference nr = nameBase1.getNomenclaturalReference();
|
268
|
assertNull("Nomenclatural Reference shall be null", nr);
|
269
|
nameBase1.setNomenclaturalReference(ReferenceFactory.newGeneric());
|
270
|
nr = nameBase1.getNomenclaturalReference();
|
271
|
assertNotNull("Nomenclatural Reference shall not be null", nr);
|
272
|
}
|
273
|
|
274
|
@Test
|
275
|
public void testGetAppendedPhrase() {
|
276
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
277
|
String appPhrase = "appPhrase";
|
278
|
assertNull(name1.getAppendedPhrase());
|
279
|
name1.setAppendedPhrase(appPhrase);
|
280
|
assertSame(appPhrase, name1.getAppendedPhrase());
|
281
|
name1.setAppendedPhrase(null);
|
282
|
assertNull(name1.getAppendedPhrase());
|
283
|
}
|
284
|
|
285
|
@Test
|
286
|
public void testGetSetNomenclaturalMicroReference() {
|
287
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
288
|
String microRef = "micro";
|
289
|
assertNull(name1.getNomenclaturalMicroReference());
|
290
|
name1.setNomenclaturalMicroReference(microRef);
|
291
|
assertSame(microRef, name1.getNomenclaturalMicroReference());
|
292
|
name1.setNomenclaturalMicroReference(null);
|
293
|
assertNull(name1.getNomenclaturalMicroReference());
|
294
|
}
|
295
|
|
296
|
@Test
|
297
|
public void testGetSetHasProblem() {
|
298
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
299
|
name1.setParsingProblem(0);
|
300
|
assertFalse(name1.hasProblem());
|
301
|
name1.setParsingProblem(1);
|
302
|
assertTrue(name1.hasProblem());
|
303
|
name1.setParsingProblem(0);
|
304
|
assertFalse(name1.getParsingProblem()!=0);
|
305
|
}
|
306
|
|
307
|
@Test
|
308
|
public void testAddNameTypeDesignation() {
|
309
|
logger.warn("not yet implemented");
|
310
|
}
|
311
|
|
312
|
@Test
|
313
|
public void testRemoveNameTypeDesignation() {
|
314
|
logger.warn("not yet implemented");
|
315
|
}
|
316
|
|
317
|
@Test
|
318
|
public void testGetSpecimenTypeDesignationsOfHomotypicalGroup() {
|
319
|
logger.warn("not yet implemented");
|
320
|
}
|
321
|
|
322
|
@Test
|
323
|
public void testAddSpecimenTypeDesignationSpecimenTypeDesignationStatusReferenceBaseStringStringBoolean() {
|
324
|
logger.warn("not yet implemented");
|
325
|
}
|
326
|
|
327
|
@Test
|
328
|
public void testAddSpecimenTypeDesignationSpecimenTypeDesignation() {
|
329
|
logger.warn("not yet implemented");
|
330
|
}
|
331
|
|
332
|
@Test
|
333
|
public void testRemoveSpecimenTypeDesignation() {
|
334
|
logger.warn("not yet implemented");
|
335
|
}
|
336
|
|
337
|
@Test
|
338
|
public void testRemoveTypeDesignation() {
|
339
|
logger.warn("not yet implemented");
|
340
|
}
|
341
|
|
342
|
@Test
|
343
|
public void testGetCitation() {
|
344
|
logger.warn("not yet implemented");
|
345
|
}
|
346
|
|
347
|
@Test
|
348
|
public void testGetCitationString() {
|
349
|
String citation = nameBase1.getCitationString();
|
350
|
logger.warn("not yet implemented");
|
351
|
}
|
352
|
|
353
|
@Test
|
354
|
public void testGetReferenceYear() {
|
355
|
logger.warn("not yet implemented");
|
356
|
}
|
357
|
|
358
|
/**
|
359
|
* Test method for {@link eu.etaxonomy.cdm.model.name.TaxonName#addTaxonBase(eu.etaxonomy.cdm.model.taxon.TaxonBase)}.
|
360
|
*/
|
361
|
@Test
|
362
|
public void testAddTaxonBase() {
|
363
|
Taxon taxon = Taxon.NewInstance(null, null);
|
364
|
nameBase2.addTaxonBase(taxon); //test if reflection method addTaxonBase() works
|
365
|
assertTrue("The taxon has not properly been added to the taxonName", nameBase2.getTaxonBases().contains(taxon));
|
366
|
assertEquals("The taxon name has not properly been added to the taxon", nameBase2, taxon.getName());
|
367
|
nameBase2.removeTaxonBase(taxon); //test if reflection method in removeTaxonBase() works
|
368
|
assertFalse("The taxon has not properly been removed from the taxon name", nameBase2.getTaxonBases().contains(taxon));
|
369
|
assertEquals("The taxon name has not properly been removed from the taxon", null, taxon.getName());
|
370
|
}
|
371
|
|
372
|
@Test
|
373
|
public void testAddAndRemoveDescriptionTaxonNameDescription() {
|
374
|
TaxonNameDescription description = TaxonNameDescription.NewInstance();
|
375
|
nameBase2.addDescription(description); //test if reflection method in addDescription() works
|
376
|
assertTrue("The description has not properly been added to the taxonName", nameBase2.getDescriptions().contains(description));
|
377
|
assertEquals("The taxon name has not properly been added to the description", nameBase2, description.getTaxonName());
|
378
|
nameBase2.removeDescription(description); //test if reflection method in removeDescription() works
|
379
|
assertFalse("The description has not properly been removed from the taxon name", nameBase2.getDescriptions().contains(description));
|
380
|
assertEquals("The taxon name has not properly been removed from the description", null, description.getTaxonName());
|
381
|
}
|
382
|
|
383
|
@Test
|
384
|
public void testGetSynonyms() {
|
385
|
logger.warn("not yet implemented");
|
386
|
}
|
387
|
|
388
|
@Test
|
389
|
public void testMergeHomotypicGroups() {
|
390
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
391
|
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(null);
|
392
|
TaxonName name3 = TaxonNameFactory.NewBotanicalInstance(null);
|
393
|
|
394
|
assertFalse(name1.getHomotypicalGroup().equals(name2.getHomotypicalGroup()));
|
395
|
int numberOfTypifiedNames = name1.getHomotypicalGroup().getTypifiedNames().size();
|
396
|
assertEquals(1, numberOfTypifiedNames);
|
397
|
|
398
|
name1.mergeHomotypicGroups(name2);
|
399
|
assertEquals(name1.getHomotypicalGroup(), name2.getHomotypicalGroup());
|
400
|
assertSame(name1.getHomotypicalGroup(), name2.getHomotypicalGroup());
|
401
|
numberOfTypifiedNames = name1.getHomotypicalGroup().getTypifiedNames().size();
|
402
|
assertEquals(2, numberOfTypifiedNames);
|
403
|
numberOfTypifiedNames = name2.getHomotypicalGroup().getTypifiedNames().size();
|
404
|
assertEquals(2, numberOfTypifiedNames);
|
405
|
assertTrue(name1.getHomotypicalGroup().getTypifiedNames().contains(name2));
|
406
|
assertTrue(name2.getHomotypicalGroup().getTypifiedNames().contains(name1));
|
407
|
|
408
|
name3.mergeHomotypicGroups(name2);
|
409
|
assertEquals(name1.getHomotypicalGroup(), name3.getHomotypicalGroup());
|
410
|
assertSame(name1.getHomotypicalGroup(), name3.getHomotypicalGroup());
|
411
|
numberOfTypifiedNames = name1.getHomotypicalGroup().getTypifiedNames().size();
|
412
|
assertEquals(3, numberOfTypifiedNames);
|
413
|
numberOfTypifiedNames = name2.getHomotypicalGroup().getTypifiedNames().size();
|
414
|
assertEquals(3, numberOfTypifiedNames);
|
415
|
numberOfTypifiedNames = name3.getHomotypicalGroup().getTypifiedNames().size();
|
416
|
assertEquals(3, numberOfTypifiedNames);
|
417
|
assertTrue(name1.getHomotypicalGroup().getTypifiedNames().contains(name2));
|
418
|
assertTrue(name2.getHomotypicalGroup().getTypifiedNames().contains(name1));
|
419
|
assertTrue(name1.getHomotypicalGroup().getTypifiedNames().contains(name3));
|
420
|
assertTrue(name3.getHomotypicalGroup().getTypifiedNames().contains(name1));
|
421
|
assertTrue(name2.getHomotypicalGroup().getTypifiedNames().contains(name3));
|
422
|
assertTrue(name3.getHomotypicalGroup().getTypifiedNames().contains(name2));
|
423
|
}
|
424
|
|
425
|
@Test
|
426
|
public void testIsBasionymFor() {
|
427
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
428
|
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(null);
|
429
|
|
430
|
assertFalse(name2.isBasionymFor(name1));
|
431
|
assertFalse(name1.isBasionymFor(name2));
|
432
|
name1.addBasionym(name2);
|
433
|
assertTrue(name2.isBasionymFor(name1));
|
434
|
assertFalse(name1.isBasionymFor(name2));
|
435
|
}
|
436
|
|
437
|
@Test
|
438
|
public void testIsHomotypic() {
|
439
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
440
|
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(null);
|
441
|
TaxonName name3 = TaxonNameFactory.NewBotanicalInstance(null);
|
442
|
TaxonName name4 = TaxonNameFactory.NewBotanicalInstance(null);
|
443
|
name1.mergeHomotypicGroups(name2);
|
444
|
name2.mergeHomotypicGroups(name4);
|
445
|
|
446
|
assertTrue(name1.isHomotypic(name4));
|
447
|
assertTrue(name4.isHomotypic(name1));
|
448
|
assertFalse(name1.isHomotypic(name3));
|
449
|
assertFalse(name3.isHomotypic(name1));
|
450
|
assertTrue(name2.isHomotypic(name1));
|
451
|
}
|
452
|
|
453
|
@Test
|
454
|
public void testMakeGroupsBasionym(){
|
455
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
456
|
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(null);
|
457
|
TaxonName name3 = TaxonNameFactory.NewBotanicalInstance(null);
|
458
|
TaxonName name4 = TaxonNameFactory.NewBotanicalInstance(null);
|
459
|
|
460
|
name1.mergeHomotypicGroups(name2);
|
461
|
name1.mergeHomotypicGroups(name3);
|
462
|
name2.mergeHomotypicGroups(name4);
|
463
|
|
464
|
name1.makeGroupsBasionym();
|
465
|
|
466
|
assertEquals(1, name2.getBasionyms().size());
|
467
|
assertEquals(1, name3.getBasionyms().size());
|
468
|
assertEquals(1, name4.getBasionyms().size());
|
469
|
assertEquals(name1, name4.getBasionym());
|
470
|
}
|
471
|
|
472
|
@Test
|
473
|
public void testIsGroupsBasionym(){
|
474
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
475
|
TaxonName name2 = TaxonNameFactory.NewBotanicalInstance(null);
|
476
|
TaxonName name3 = TaxonNameFactory.NewBotanicalInstance(null);
|
477
|
TaxonName name4 = TaxonNameFactory.NewBotanicalInstance(null);
|
478
|
|
479
|
assertFalse(name1.isGroupsBasionym());
|
480
|
|
481
|
name1.mergeHomotypicGroups(name2);
|
482
|
name2.mergeHomotypicGroups(name4);
|
483
|
|
484
|
name1.makeGroupsBasionym();
|
485
|
|
486
|
assertTrue(name1.isGroupsBasionym());
|
487
|
assertFalse(name2.isGroupsBasionym());
|
488
|
name1.mergeHomotypicGroups(name3);
|
489
|
assertFalse(name1.isGroupsBasionym());
|
490
|
}
|
491
|
|
492
|
@Test
|
493
|
public void testRemoveBasionyms(){
|
494
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
495
|
TaxonName basionym1 = TaxonNameFactory.NewBotanicalInstance(null);
|
496
|
TaxonName basionym2 = TaxonNameFactory.NewBotanicalInstance(null);
|
497
|
|
498
|
name1.addBasionym(basionym1);
|
499
|
assertEquals(1, name1.getBasionyms().size());
|
500
|
name1.addBasionym(basionym2);
|
501
|
assertEquals(2, name1.getBasionyms().size());
|
502
|
name1.removeBasionyms();
|
503
|
assertEquals(0, name1.getBasionyms().size());
|
504
|
}
|
505
|
|
506
|
@Test
|
507
|
public void testRemoveRelationWithTaxonName(){
|
508
|
TaxonName name1 = TaxonNameFactory.NewBotanicalInstance(null);
|
509
|
TaxonName basionym1 = TaxonNameFactory.NewBotanicalInstance(null);
|
510
|
TaxonName basionym2 = TaxonNameFactory.NewBotanicalInstance(null);
|
511
|
|
512
|
name1.addBasionym(basionym1);
|
513
|
assertEquals(1, name1.getBasionyms().size());
|
514
|
name1.addBasionym(basionym2);
|
515
|
assertEquals(2, name1.getBasionyms().size());
|
516
|
name1.removeRelationWithTaxonName(basionym1, Direction.relatedTo, NameRelationshipType.BASIONYM());
|
517
|
assertEquals(1, name1.getBasionyms().size());
|
518
|
}
|
519
|
|
520
|
@Test
|
521
|
public void testIsSupraGeneric() {
|
522
|
nameBase1.setRank(Rank.FAMILY());
|
523
|
assertTrue(nameBase1.isSupraGeneric());
|
524
|
nameBase1.setRank(Rank.GENUS());
|
525
|
assertFalse(nameBase1.isSupraGeneric());
|
526
|
nameBase1.setRank(Rank.FORM());
|
527
|
assertFalse(nameBase1.isSupraGeneric());
|
528
|
nameBase1.setRank(null);
|
529
|
assertFalse(nameBase1.isSupraGeneric());
|
530
|
}
|
531
|
|
532
|
@Test
|
533
|
public void testRemoveTaxonBases(){
|
534
|
|
535
|
Taxon newTaxon = Taxon.NewInstance(nameBase1, null);
|
536
|
assertEquals(1, nameBase1.getTaxonBases().size());
|
537
|
|
538
|
nameBase1.removeTaxonBase(newTaxon);
|
539
|
assertEquals(0, nameBase1.getTaxonBases().size());
|
540
|
}
|
541
|
|
542
|
@Test
|
543
|
public void testIsGenus() {
|
544
|
nameBase1.setRank(Rank.FAMILY());
|
545
|
assertFalse(nameBase1.isGenus());
|
546
|
nameBase1.setRank(Rank.GENUS());
|
547
|
assertTrue(nameBase1.isGenus());
|
548
|
nameBase1.setRank(Rank.FORM());
|
549
|
assertFalse(nameBase1.isGenus());
|
550
|
nameBase1.setRank(null);
|
551
|
assertFalse(nameBase1.isGenus());
|
552
|
}
|
553
|
|
554
|
@Test
|
555
|
public void testIsInfraGeneric() {
|
556
|
nameBase1.setRank(Rank.FAMILY());
|
557
|
assertFalse(nameBase1.isInfraGeneric());
|
558
|
nameBase1.setRank(Rank.GENUS());
|
559
|
assertFalse(nameBase1.isInfraGeneric());
|
560
|
nameBase1.setRank(Rank.SUBGENUS());
|
561
|
assertTrue(nameBase1.isInfraGeneric());
|
562
|
nameBase1.setRank(Rank.SPECIES());
|
563
|
assertFalse(nameBase1.isInfraGeneric());
|
564
|
nameBase1.setRank(Rank.FORM());
|
565
|
assertFalse(nameBase1.isInfraGeneric());
|
566
|
nameBase1.setRank(Rank.INFRAGENERICTAXON());
|
567
|
assertTrue(nameBase1.isInfraGeneric());
|
568
|
nameBase1.setRank(null);
|
569
|
assertFalse(nameBase1.isInfraGeneric());
|
570
|
}
|
571
|
|
572
|
@Test
|
573
|
public void testIsSpecies() {
|
574
|
nameBase1.setRank(Rank.FAMILY());
|
575
|
assertFalse(nameBase1.isSpecies());
|
576
|
nameBase1.setRank(Rank.GENUS());
|
577
|
assertFalse(nameBase1.isSpecies());
|
578
|
nameBase1.setRank(Rank.SUBGENUS());
|
579
|
assertFalse(nameBase1.isSpecies());
|
580
|
nameBase1.setRank(Rank.SPECIES());
|
581
|
assertTrue(nameBase1.isSpecies());
|
582
|
nameBase1.setRank(Rank.FORM());
|
583
|
assertFalse(nameBase1.isSpecies());
|
584
|
nameBase1.setRank(null);
|
585
|
assertFalse(nameBase1.isSpecies());
|
586
|
}
|
587
|
|
588
|
@Test
|
589
|
public void testIsInfraSpecific() {
|
590
|
nameBase1.setRank(Rank.FAMILY());
|
591
|
assertFalse(nameBase1.isInfraSpecific());
|
592
|
nameBase1.setRank(Rank.GENUS());
|
593
|
assertFalse(nameBase1.isInfraSpecific());
|
594
|
nameBase1.setRank(Rank.SUBGENUS());
|
595
|
assertFalse(nameBase1.isInfraSpecific());
|
596
|
nameBase1.setRank(Rank.SPECIES());
|
597
|
assertFalse(nameBase1.isInfraSpecific());
|
598
|
nameBase1.setRank(Rank.FORM());
|
599
|
assertTrue(nameBase1.isInfraSpecific());
|
600
|
nameBase1.setRank(Rank.INFRASPECIFICTAXON());
|
601
|
assertTrue(nameBase1.isInfraSpecific());
|
602
|
nameBase1.setRank(null);
|
603
|
assertFalse(nameBase1.isInfraSpecific());
|
604
|
}
|
605
|
|
606
|
//descriptions, fullTitleCache, homotypicalGroup,
|
607
|
|
608
|
//no changes to: appendedPharse, nomenclaturalReference,
|
609
|
//nomenclaturalMicroReference, parsingProblem, problemEnds, problemStarts
|
610
|
//protectedFullTitleCache
|
611
|
|
612
|
@Test
|
613
|
public void testClone(){
|
614
|
|
615
|
//Create data
|
616
|
TaxonName taxonName1 = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
|
617
|
TaxonName genusName = TaxonNameFactory.NewNonViralInstance(Rank.GENUS());
|
618
|
Taxon.NewInstance(taxonName1, null);
|
619
|
|
620
|
//basionym & homonym
|
621
|
TaxonName basionym = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
|
622
|
TaxonName earlierHomonym = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
|
623
|
NameRelationship basionymRelation = taxonName1.addBasionym(basionym);
|
624
|
NameRelationship homonymRelation = taxonName1.addRelationshipToName(earlierHomonym, NameRelationshipType.LATER_HOMONYM(), "later homonym rule", null);
|
625
|
//status
|
626
|
Reference statusReference = ReferenceFactory.newArticle();
|
627
|
NomenclaturalStatus nomStatus = NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED(), statusReference, "55");
|
628
|
taxonName1.addStatus(nomStatus);
|
629
|
//typeDesignation
|
630
|
DerivedUnit typeSpecimen = DerivedUnit.NewPreservedSpecimenInstance();
|
631
|
Reference specimenTypeCitation = ReferenceFactory.newArticle();
|
632
|
Reference nameTypeCitation = ReferenceFactory.newArticle();
|
633
|
SpecimenTypeDesignation specimenTypeDesignationOriginal = taxonName1.addSpecimenTypeDesignation(typeSpecimen, SpecimenTypeDesignationStatus.HOLOTYPE(), specimenTypeCitation, null, null, false, false);
|
634
|
NameTypeDesignation nameTypeDesignationOriginal = genusName.addNameTypeDesignation(taxonName1, nameTypeCitation, null, null, NameTypeDesignationStatus.LECTOTYPE(), true, false, false, false);
|
635
|
|
636
|
//description
|
637
|
TaxonNameDescription description = TaxonNameDescription.NewInstance(taxonName1);
|
638
|
TextData textData = TextData.NewInstance(Feature.IMAGE());
|
639
|
textData.putText(Language.DEFAULT(), "My media text data");
|
640
|
Media media = Media.NewInstance();
|
641
|
textData.addMedia(media);
|
642
|
description.addElement(textData);
|
643
|
|
644
|
//CLONE
|
645
|
TaxonName clone = taxonName1.clone();
|
646
|
TaxonName genusClone = genusName.clone();
|
647
|
assertSame("Rank should be same", taxonName1.getRank(), clone.getRank());
|
648
|
assertTrue("TaxonBases should not be cloned", clone.getTaxonBases().isEmpty());
|
649
|
assertEquals("TaxonBases of original name should not be empty", 1, taxonName1.getTaxonBases().size());
|
650
|
//homotypical groups are not cloned, see documentation
|
651
|
assertNotSame("The clone must have a new homotypical group", taxonName1.getHomotypicalGroup(), clone.getHomotypicalGroup());
|
652
|
assertNotSame("The genusClone must a new homotypical group", genusName.getHomotypicalGroup(), genusClone.getHomotypicalGroup());
|
653
|
assertEquals("Only the name should be part of the new homotypical group", 1, clone.getHomotypicalGroup().getTypifiedNames().size());
|
654
|
|
655
|
//description
|
656
|
assertEquals("There should be exactly 1 name description", 1, clone.getDescriptions().size());
|
657
|
TaxonNameDescription descriptionClone = clone.getDescriptions().iterator().next();
|
658
|
assertEquals("There should be exactly 1 description element", 1, descriptionClone.getElements().size());
|
659
|
TextData textDataClone = (TextData)descriptionClone.getElements().iterator().next();
|
660
|
String text = textDataClone.getText(Language.DEFAULT());
|
661
|
assertEquals("Textdata should be equal", "My media text data", text);
|
662
|
assertEquals("There should be exactly 1 media attached", 1, textDataClone.getMedia().size());
|
663
|
Media mediaClone = textDataClone.getMedia().get(0);
|
664
|
assertSame("Media must be the same", media, mediaClone);
|
665
|
|
666
|
//type designation
|
667
|
assertEquals("There should be exactly 1 specimen type designation", 1, clone.getTypeDesignations().size());
|
668
|
assertNotSame("type designation sets should not be the same", taxonName1.getTypeDesignations(), clone.getTypeDesignations());
|
669
|
SpecimenTypeDesignation specimenTypeDesignationClone = (SpecimenTypeDesignation)clone.getTypeDesignations().iterator().next();
|
670
|
assertNotSame("The specimen type designation should not be the same", specimenTypeDesignationOriginal, specimenTypeDesignationClone);
|
671
|
assertSame("The derived unit of the specimen type designation needs to be the same", specimenTypeDesignationOriginal.getTypeSpecimen(), specimenTypeDesignationClone.getTypeSpecimen());
|
672
|
assertSame("The status of the specimen type designation needs to be the same", specimenTypeDesignationOriginal.getTypeStatus(), specimenTypeDesignationClone.getTypeStatus());
|
673
|
assertEquals("The specimen type designation must have exactly 1 typified name which is 'clone'", 1, specimenTypeDesignationClone.getTypifiedNames().size());
|
674
|
assertTrue("The specimen type designation must have 'clone' as typified name", specimenTypeDesignationClone.getTypifiedNames().contains(clone));
|
675
|
// assertSame("The specimen type designation must have the same homotypical group as the typified name", specimenTypeDesignationClone.getHomotypicalGroup(), clone.getHomotypicalGroup());
|
676
|
|
677
|
assertEquals("There should be exactly 1 name type designation", 1, genusClone.getTypeDesignations().size());
|
678
|
assertNotSame("type designation sets should not be the same", genusName.getTypeDesignations(), genusClone.getTypeDesignations());
|
679
|
NameTypeDesignation nameTypeDesignationClone = (NameTypeDesignation)genusClone.getTypeDesignations().iterator().next();
|
680
|
assertNotSame("The name type designation should not be the same", nameTypeDesignationOriginal, nameTypeDesignationClone);
|
681
|
assertSame("The nyme type of the name type designation needs to be the same", taxonName1, nameTypeDesignationClone.getTypeName());
|
682
|
assertSame("The status of the name type designation needs to be the same", nameTypeDesignationOriginal.getTypeStatus(), nameTypeDesignationClone.getTypeStatus());
|
683
|
assertEquals("The name type designation must have exactly 1 typified name which is 'genusClone'", 1, nameTypeDesignationClone.getTypifiedNames().size());
|
684
|
assertTrue("The name type designation must have 'genusClone' as typified name", nameTypeDesignationClone.getTypifiedNames().contains(genusClone));
|
685
|
// assertSame("The name type designation must have the same homotypical group as the typified name", nameTypeDesignationClone.getHomotypicalGroup(), genusClone.getHomotypicalGroup());
|
686
|
|
687
|
//status
|
688
|
assertEquals("There should be exactly 1 status", 1, clone.getStatus().size());
|
689
|
assertNotSame("Status sets should not be the same", taxonName1.getStatus(), clone.getStatus());
|
690
|
NomenclaturalStatus cloneStatus = clone.getStatus().iterator().next();
|
691
|
assertSame("The type of the nomStatus needs to be the same", nomStatus.getType(), cloneStatus.getType());
|
692
|
assertSame("The citation of the nomStatus needs to be the same", nomStatus.getCitation(), cloneStatus.getCitation());
|
693
|
assertSame("The rule considered of the nomStatus needs to be the same", nomStatus.getRuleConsidered(), cloneStatus.getRuleConsidered());
|
694
|
assertNotSame("The nomStatus should be cloned as it is orphan removal", nomStatus, cloneStatus);
|
695
|
|
696
|
// //hybrid parents of clone
|
697
|
// assertEquals("There should be exactly 2 hybrid relationships in which the clone takes the child role", 2, clone.getChildRelationships().size());
|
698
|
// Set<NonViralName> parentSet = new HashSet<>();
|
699
|
// Set<NonViralName> childSet = new HashSet<>();
|
700
|
// for (Object object : clone.getChildRelationships()){
|
701
|
// HybridRelationship childRelation = (HybridRelationship)object;
|
702
|
// NonViralName relatedFrom = childRelation.getRelatedFrom();
|
703
|
// parentSet.add(relatedFrom);
|
704
|
// NonViralName relatedTo = childRelation.getRelatedTo();
|
705
|
// childSet.add(relatedTo);
|
706
|
// }
|
707
|
// assertTrue("Parent set should contain parent1", parentSet.contains(parent));
|
708
|
// assertTrue("Parent set should contain parent2", parentSet.contains(parent2));
|
709
|
// assertTrue("Child set should contain clone", childSet.contains(clone));
|
710
|
|
711
|
//basionym of clone
|
712
|
assertEquals("There should be exactly 1 relationship in which the clone takes the -to- role", 1, clone.getRelationsToThisName().size());
|
713
|
NameRelationship basionymRelationClone = clone.getRelationsToThisName().iterator().next();
|
714
|
assertNotEquals(basionymRelation, basionymRelationClone);
|
715
|
//related name should not be cloned, if needed e.g. for basionyms this should be handled by the calling method (see documentation)
|
716
|
assertSame("Basionym should be from-object in relationship", basionym, basionymRelationClone.getRelatedFrom());
|
717
|
assertSame("Clone should be to-object in relationship", clone, basionymRelationClone.getRelatedTo());
|
718
|
assertSame("Relationship type should be cloned correctly", NameRelationshipType.BASIONYM(), basionymRelationClone.getType());
|
719
|
|
720
|
//homonym of clone
|
721
|
assertEquals("There should be exactly 1 relationship in which the clone takes the from role", 1, clone.getRelationsFromThisName().size());
|
722
|
NameRelationship homonymRelationClone = clone.getRelationsFromThisName().iterator().next();
|
723
|
assertNotEquals(homonymRelation, homonymRelationClone);
|
724
|
assertSame("Clone should be from-object in relationship", clone, homonymRelationClone.getRelatedFrom());
|
725
|
assertSame("Homonym should be to-object in relationship", earlierHomonym, homonymRelationClone.getRelatedTo());
|
726
|
assertSame("Relationship type should be cloned correctly", NameRelationshipType.LATER_HOMONYM(), homonymRelationClone.getType());
|
727
|
assertEquals("Rule should be cloned correctly", "later homonym rule", homonymRelationClone.getRuleConsidered());
|
728
|
}
|
729
|
|
730
|
|
731
|
/*
|
732
|
* Moved from IdentifiableEntityTest to here due to #922
|
733
|
*/
|
734
|
@Test
|
735
|
public void testCompareTo() {
|
736
|
TaxonName abies = TaxonNameFactory.NewNonViralInstance(Rank.GENUS(), null);
|
737
|
abies.setNameCache("Abies");
|
738
|
abies.setTitleCache("Abies", true);
|
739
|
|
740
|
TaxonName abiesMill = TaxonNameFactory.NewNonViralInstance(Rank.GENUS(), null);
|
741
|
abiesMill.setNameCache("Abies");
|
742
|
abiesMill.setTitleCache("Abies Mill.", true);
|
743
|
|
744
|
TaxonName abiesAlba = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES(), null);
|
745
|
abiesAlba.setNameCache("Abies alba");
|
746
|
abiesAlba.setTitleCache("Abies alba", true);
|
747
|
|
748
|
TaxonName abiesAlbaMichx = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES(), null);
|
749
|
abiesAlbaMichx.setNameCache("Abies alba");
|
750
|
abiesAlbaMichx.setTitleCache("Abies alba Michx.", true);
|
751
|
|
752
|
TaxonName abiesAutonym = TaxonNameFactory.NewNonViralInstance(Rank.SECTION_BOTANY());
|
753
|
abiesAutonym.setGenusOrUninomial("Abies");
|
754
|
abiesAutonym.setInfraGenericEpithet("Abies");
|
755
|
|
756
|
abiesAutonym.setTitleCache("Abies Mill. sect. Abies", true);
|
757
|
abiesAutonym.getNameCache();
|
758
|
|
759
|
TaxonName abiesBalsamea = TaxonNameFactory.NewNonViralInstance(Rank.SECTION_BOTANY());
|
760
|
abiesBalsamea.setGenusOrUninomial("Abies");
|
761
|
abiesBalsamea.setInfraGenericEpithet("Balsamea");
|
762
|
abiesBalsamea.getNameCache();
|
763
|
abiesBalsamea.setTitleCache("Abies sect. Balsamea L.", true);
|
764
|
|
765
|
TaxonName abiesAlbaxPinusBeta = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
|
766
|
abiesAlbaxPinusBeta.setHybridFormula(true);
|
767
|
abiesAlbaxPinusBeta.addHybridParent(abiesAlba, HybridRelationshipType.FIRST_PARENT(), null);
|
768
|
|
769
|
int result = 0;
|
770
|
|
771
|
// "Abies" < "Abies Mill."
|
772
|
result = abies.compareToName(abiesMill);
|
773
|
assertTrue(result < 0);
|
774
|
|
775
|
// "Abies Mill." > "Abies"
|
776
|
result = abiesMill.compareToName(abies);
|
777
|
assertTrue(result > 0);
|
778
|
|
779
|
// "Abies" < "Abies alba"
|
780
|
result = abies.compareToName(abiesAlba);
|
781
|
assertTrue(result < 0);
|
782
|
|
783
|
// "Abies alba" > "Abies"
|
784
|
result = abiesAlba.compareToName(abies);
|
785
|
assertTrue(result > 0);
|
786
|
|
787
|
// "Abies Mill." < "Abies alba Michx."
|
788
|
result = abiesMill.compareToName(abiesAlbaMichx);
|
789
|
assertTrue(result < 0);
|
790
|
|
791
|
// "Abies alba Michx." > "Abies Mill."
|
792
|
result = abiesAlbaMichx.compareToName(abiesMill);
|
793
|
assertTrue(result > 0);
|
794
|
|
795
|
//Autonym should be sorted without the author string
|
796
|
|
797
|
result = abiesAutonym.compareToName(abiesBalsamea);
|
798
|
assertTrue(result < 0);
|
799
|
// Test consistency of compareTo() with equals():
|
800
|
// Is consistent if and only if for every e1 and e2 of class C
|
801
|
// e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2)
|
802
|
|
803
|
boolean compareResult = false;
|
804
|
boolean equalsResult = false;
|
805
|
|
806
|
compareResult = (abies.compareToName(abies) == 0);
|
807
|
equalsResult = abies.equals(abies);
|
808
|
assertEquals(compareResult, equalsResult);
|
809
|
|
810
|
compareResult = (abies.compareToName(abiesAlba) == 0);
|
811
|
equalsResult = abies.equals(abiesAlba);
|
812
|
assertEquals(compareResult, equalsResult);
|
813
|
|
814
|
compareResult = (abiesMill.compareToName(abies) == 0);
|
815
|
equalsResult = abiesMill.equals(abies);
|
816
|
assertEquals(compareResult, equalsResult);
|
817
|
|
818
|
//Abies alba x Pinus beta < Abies alba xinus
|
819
|
TaxonName abiesAlbaXinus = TaxonNameFactory.NewBotanicalInstance(Rank.SUBSPECIES());
|
820
|
abiesAlbaXinus.setGenusOrUninomial("Abies");
|
821
|
abiesAlbaXinus.setSpecificEpithet("alba");
|
822
|
abiesAlbaXinus.setInfraSpecificEpithet("xinus");
|
823
|
result = abiesAlbaxPinusBeta.compareToName(abiesAlbaXinus);
|
824
|
assertTrue(result < 0);
|
825
|
}
|
826
|
|
827
|
@Test
|
828
|
public void testNomenclaturalStanding() {
|
829
|
//The status and relationship combinations in this test are not semantically consistent
|
830
|
//but only used for testing
|
831
|
Assert.assertTrue(nameBase1.isNoStatus());
|
832
|
nameBase1.addRelationshipFromName(nameBase2, NameRelationshipType.CONSERVED_AGAINST());
|
833
|
Assert.assertTrue(nameBase1.isDesignationOnly());
|
834
|
nameBase1.addStatus(NomenclaturalStatus.NewInstance(NomenclaturalStatusType.AMBIGUOUS()));
|
835
|
Assert.assertTrue("nothing changed", nameBase1.isDesignationOnly());
|
836
|
Assert.assertTrue(nameBase1.isInvalid());
|
837
|
nameBase1.addStatus(NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ILLEGITIMATE()));
|
838
|
Assert.assertFalse(nameBase1.isIllegitimate());
|
839
|
Assert.assertTrue(nameBase1.isDesignationOnly());
|
840
|
nameBase1.addStatus(NomenclaturalStatus.NewInstance(NomenclaturalStatusType.INVALID()));
|
841
|
Assert.assertFalse(nameBase1.isDesignationOnly());
|
842
|
Assert.assertTrue(nameBase1.isInvalid());
|
843
|
nameBase1.addRelationshipToName(nameBase2, NameRelationshipType.CONSERVED_AGAINST());
|
844
|
Assert.assertTrue(nameBase1.isValid());
|
845
|
}
|
846
|
}
|