2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.api
.service
;
11 import static org
.junit
.Assert
.assertEquals
;
12 import static org
.junit
.Assert
.assertNotNull
;
13 import static org
.junit
.Assert
.assertSame
;
16 import java
.util
.UUID
;
18 import org
.apache
.log4j
.Logger
;
19 import org
.junit
.Assert
;
20 import org
.junit
.Ignore
;
21 import org
.junit
.Test
;
22 import org
.unitils
.dbunit
.annotation
.DataSet
;
23 import org
.unitils
.spring
.annotation
.SpringBeanByType
;
25 import eu
.etaxonomy
.cdm
.api
.service
.config
.NameDeletionConfigurator
;
26 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
27 import eu
.etaxonomy
.cdm
.model
.common
.DescriptionElementSource
;
28 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
29 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
30 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
31 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
32 import eu
.etaxonomy
.cdm
.model
.description
.TaxonNameDescription
;
33 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
34 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
35 import eu
.etaxonomy
.cdm
.model
.name
.HybridRelationshipType
;
36 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
37 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
38 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
39 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignationStatus
;
40 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
41 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
42 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
43 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
44 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
45 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
46 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
47 import eu
.etaxonomy
.cdm
.model
.name
.TypeDesignationBase
;
48 import eu
.etaxonomy
.cdm
.model
.occurrence
.Fossil
;
49 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
50 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
51 import eu
.etaxonomy
.cdm
.test
.integration
.CdmTransactionalIntegrationTest
;
52 import eu
.etaxonomy
.cdm
.test
.unitils
.CleanSweepInsertLoadStrategy
;
58 public class NameServiceImplTest
extends CdmTransactionalIntegrationTest
{
59 private static final Logger logger
= Logger
.getLogger(NameServiceImplTest
.class);
62 private INameService nameService
;
65 private IOccurrenceService occurrenceService
;
68 private ITaxonService taxonService
;
71 private ITermService termService
;
74 /* ******************** TESTS ********************************************/
77 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#setDao(eu.etaxonomy.cdm.persistence.dao.name.ITaxonNameDao)}.
80 public void testSetDao() {
81 // Assert.assertNotNull(((NameServiceImpl)nameService).dao);
85 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#setVocabularyDao(eu.etaxonomy.cdm.persistence.dao.common.ITermVocabularyDao)}.
88 public void testSetVocabularyDao() {
89 // Assert.assertNotNull(( (NameServiceImpl)nameService).vocabularyDao);
93 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getNamesByName(java.lang.String)}.
96 public void testGetNamesByName() {
97 logger
.warn("Not yet implemented");
101 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTaxonNameByUuid(java.util.UUID)}.
104 public void testGetTaxonNameByUuid() {
105 logger
.warn("Not yet implemented");
109 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#saveTaxonName(eu.etaxonomy.cdm.model.name.TaxonNameBase)}.
112 public void testSaveTaxonName() {
113 logger
.warn("Not yet implemented");
117 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#saveTaxonNameAll(java.util.Collection)}.
120 public void testSaveTaxonNameAll() {
121 logger
.warn("Not yet implemented");
125 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#removeTaxon(eu.etaxonomy.cdm.model.name.TaxonNameBase)}.
128 public void testRemoveTaxon() {
129 logger
.warn("Not yet implemented");
133 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getAllNames(int, int)}.
136 public void testGetAllNames() {
137 logger
.warn("Not yet implemented");
141 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getRankVocabulary()}.
144 @Ignore //FIXME assertSame does not work yet
145 public void testGetRankVocabulary() {
146 //TODO move test to vocabulary service
147 OrderedTermVocabulary
<Rank
> rankVocabulary
= nameService
.getRankVocabulary();
148 assertNotNull(rankVocabulary
);
149 assertEquals(66, rankVocabulary
.size());
150 Rank highestRank
= rankVocabulary
.getHighestTerm();
151 assertEquals(Rank
.EMPIRE(), highestRank
);
152 assertEquals(Rank
.DOMAIN(), rankVocabulary
.getNextLowerTerm(highestRank
));
153 assertSame(Rank
.EMPIRE(), highestRank
);
154 assertSame(Rank
.DOMAIN(), rankVocabulary
.getNextLowerTerm(highestRank
));
158 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTypeDesignationVocabulary()}.
161 @Ignore //not yet correctly implemented
162 public void testGetTypeDesignationVocabulary() {
163 //TODO move test to vocabulary service
164 OrderedTermVocabulary
<SpecimenTypeDesignationStatus
> typeDesignationVocabulary
=
165 nameService
.getSpecimenTypeDesignationVocabulary();
166 assertNotNull(typeDesignationVocabulary
);
167 assertEquals(20, typeDesignationVocabulary
.size());
168 SpecimenTypeDesignationStatus highestType
= typeDesignationVocabulary
.getHighestTerm();
169 assertEquals(SpecimenTypeDesignationStatus
.EPITYPE(), highestType
);
170 assertEquals(SpecimenTypeDesignationStatus
.HOLOTYPE(), typeDesignationVocabulary
.getNextLowerTerm(highestType
));
171 assertSame(SpecimenTypeDesignationStatus
.EPITYPE(), highestType
);
172 assertSame(SpecimenTypeDesignationStatus
.HOLOTYPE(), typeDesignationVocabulary
.getNextLowerTerm(highestType
));
176 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
179 public void testGenerateTitleCache() {
180 logger
.warn("Not yet implemented");
184 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
187 @DataSet(loadStrategy
=CleanSweepInsertLoadStrategy
.class)
188 public void testDeleteTaxonNameBaseWithNameRelations() {
190 final String
[] tableNames
= new String
[]{"USERACCOUNT", "TaxonNameBase","NameRelationship","HybridRelationship","DescriptionBase","NomenclaturalStatus","TaxonBase","SpecimenOrObservationBase","OriginalSourceBase","DescriptionElementBase"};
191 // printDataSetWithNull(System.err, true, null);
193 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
194 name1
.setTitleCache("Name1", true);
195 TaxonNameBase
<?
,?
> nameWithBasionym
= BotanicalName
.NewInstance(getSpeciesRank());
196 nameWithBasionym
.setTitleCache("nameWithBasionym", true);
198 NameRelationshipType nameRelType
= (NameRelationshipType
)termService
.find(NameRelationshipType
.BASIONYM().getUuid());
199 name1
.addRelationshipToName(nameWithBasionym
,nameRelType
, null, null, null);
200 // nameWithBasionym.addBasionym(name1);
201 nameService
.save(name1
);
202 commitAndStartNewTransaction(tableNames
);
205 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
206 nameService
.delete(name1
);
207 Assert
.fail("Delete should throw an error as long as name relationships exist.");
208 } catch (Exception e
) {
209 if (e
.getMessage().contains("Name can't be deleted as it is used in name relationship")){
211 endTransaction(); //exception rolls back transaction!
212 // printDataSet(System.out, tableNames);
213 startNewTransaction();
215 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
218 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
219 Assert
.assertNotNull("Name should still be in database",name1
);
220 nameWithBasionym
= ((NameRelationship
)name1
.getNameRelations().iterator().next()).getToName();
221 nameWithBasionym
.removeBasionyms();
222 nameService
.delete(name1
); //should throw now exception
223 commitAndStartNewTransaction(tableNames
);
224 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
225 Assert
.assertNull("Name should not be in database anymore",name1
);
231 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
235 @DataSet(loadStrategy
=CleanSweepInsertLoadStrategy
.class)
236 public void testDeleteTaxonNameBaseConfiguratorWithNameRelations() {
237 final String
[] tableNames
= new String
[]{"TaxonNameBase","NameRelationship","HybridRelationship"};
239 // printDataSet(System.err, new String[]{"TaxonNameBase","NameRelationship","HybridRelationship","DescriptionBase","NomenclaturalStatus","TaxonBase","SpecimenOrObservationBase","OriginalSourceBase",
240 // "DescriptionElementBase",
241 // "AGENTBASE", "USERACCOUNT", "PERMISSIONGROUP", "USERACCOUNT_PERMISSIONGROUP", "USERACCOUNT_GRANTEDAUTHORITYIMPL", "GRANTEDAUTHORITYIMPL"});
243 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
244 name1
.setTitleCache("Name1", true);
245 TaxonNameBase
<?
,?
> nameWithBasionym
= BotanicalName
.NewInstance(getSpeciesRank());
246 nameWithBasionym
.setTitleCache("nameWithBasionym", true);
248 NameRelationshipType nameRelType
= (NameRelationshipType
)termService
.find(NameRelationshipType
.BASIONYM().getUuid());
249 name1
.addRelationshipToName(nameWithBasionym
,nameRelType
, null, null, null);
250 nameService
.save(name1
);
251 commitAndStartNewTransaction(tableNames
);
252 NameDeletionConfigurator config
= new NameDeletionConfigurator();
254 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
255 nameService
.delete(name1
, config
);
256 Assert
.fail("Delete should throw an error as long as name relationships exist.");
257 } catch (Exception e
) {
258 if (e
.getMessage().startsWith("Name can't be deleted as it is used in name relationship")){
260 endTransaction(); //exception rolls back transaction!
261 // printDataSet(System.out, tableNames);
262 startNewTransaction();
264 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
267 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
268 Assert
.assertNotNull("Name should still be in database",name1
);
270 //ignore is basionym for
271 config
.setIgnoreIsBasionymFor(true);
273 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
274 nameService
.delete(name1
, config
);
275 commitAndStartNewTransaction(tableNames
);
276 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
277 Assert
.assertNull("Name should not be in database anymore",name1
);
278 } catch (Exception e
) {
279 Assert
.fail("Delete should not throw an error for .");
284 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
287 public void testDeleteTaxonNameBaseConfiguratorWithNameRelationsAll() {
288 final String
[] tableNames
= new String
[]{"TaxonNameBase","NameRelationship","HybridRelationship"};
290 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
291 name1
.setTitleCache("Name1", true);
292 TaxonNameBase
<?
,?
> nameWithBasionym
= BotanicalName
.NewInstance(getSpeciesRank());
293 nameWithBasionym
.setTitleCache("nameWithBasionym", true);
295 NameRelationshipType nameRelType
= (NameRelationshipType
)termService
.find(NameRelationshipType
.BASIONYM().getUuid());
296 name1
.addRelationshipToName(nameWithBasionym
,nameRelType
, null, null, null);
297 nameService
.save(name1
);
298 commitAndStartNewTransaction(tableNames
);
299 NameDeletionConfigurator config
= new NameDeletionConfigurator();
301 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
302 nameService
.delete(name1
, config
);
303 Assert
.fail("Delete should throw an error as long as name relationships exist.");
304 } catch (Exception e
) {
305 if (e
.getMessage().startsWith("Name can't be deleted as it is used in name relationship")){
307 endTransaction(); //exception rolls back transaction!
308 // printDataSet(System.out, tableNames);
309 startNewTransaction();
311 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
314 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
315 Assert
.assertNotNull("Name should still be in database",name1
);
317 //ignore all name relationships
318 config
.setRemoveAllNameRelationships(true);
320 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
321 nameService
.delete(name1
, config
);
322 commitAndStartNewTransaction(tableNames
);
323 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
324 Assert
.assertNull("Name should not be in database anymore",name1
);
325 } catch (Exception e
) {
326 Assert
.fail("Delete should not throw an error for .");
331 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
334 public void testDeleteTaxonNameBaseConfiguratorWithHasBasionym() {
335 final String
[] tableNames
= new String
[]{"TaxonNameBase","NameRelationship","HybridRelationship"};
337 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
338 name1
.setTitleCache("Name1", true);
339 TaxonNameBase
<?
,?
> basionym
= BotanicalName
.NewInstance(getSpeciesRank());
340 basionym
.setTitleCache("basionym", true);
342 NameRelationshipType nameRelType
= (NameRelationshipType
)termService
.find(NameRelationshipType
.BASIONYM().getUuid());
343 basionym
.addRelationshipToName(name1
,nameRelType
, null, null, null);
344 nameService
.save(name1
);
345 commitAndStartNewTransaction(tableNames
);
346 NameDeletionConfigurator config
= new NameDeletionConfigurator();
347 config
.setIgnoreHasBasionym(false);
349 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
350 nameService
.delete(name1
, config
);
351 Assert
.fail("Delete should throw an error as long as name relationships exist.");
352 } catch (Exception e
) {
353 if (e
.getMessage().startsWith("Name can't be deleted as it is used in name relationship")){
355 endTransaction(); //exception rolls back transaction!
356 // printDataSet(System.out, tableNames);
357 startNewTransaction();
359 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
362 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
363 Assert
.assertNotNull("Name should still be in database",name1
);
365 //ignore has basionym
366 config
.setIgnoreHasBasionym(true);
368 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
369 nameService
.delete(name1
, config
);
370 commitAndStartNewTransaction(tableNames
);
371 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
372 Assert
.assertNull("Name should not be in database anymore",name1
);
373 } catch (Exception e
) {
374 Assert
.fail("Delete should not throw an error for .");
380 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
383 @Ignore //currently does not run in suite
384 public void testDeleteTaxonNameBaseWithHybridRelations() {
385 final String
[] tableNames
= new String
[]{"TaxonNameBase","NameRelationship","HybridRelationship"};
387 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
388 name1
.setTitleCache("Name1", true);
389 NonViralName
<?
> parent
= BotanicalName
.NewInstance(getSpeciesRank());
390 parent
.setTitleCache("parent", true);
391 NonViralName
<?
> child
= BotanicalName
.NewInstance(getSpeciesRank());
392 child
.setTitleCache("child", true);
394 HybridRelationshipType relType
= (HybridRelationshipType
)termService
.find(HybridRelationshipType
.FIRST_PARENT().getUuid());
395 name1
.addHybridParent(parent
, relType
, null);
396 nameService
.save(name1
);
397 commitAndStartNewTransaction(tableNames
); //otherwise first save is rolled back with following failing delete
398 Assert
.assertEquals("'Parent' should be a parent in a hybrid relation.", 1,parent
.getHybridParentRelations().size());
399 // printDataSet(System.out, tableNames);
403 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
404 nameService
.delete(name1
);
405 //delete via cascade -> no exception
406 } catch (Exception e
) {
407 Assert
.fail("Delete should throw NO exception when deleting a hybrid child: " + e
.getMessage());
409 commitAndStartNewTransaction(tableNames
);
410 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
411 Assert
.assertNull("Name should not be in database anymore",name1
);
412 parent
= (NonViralName
<?
>)nameService
.find(parent
.getUuid());
413 Assert
.assertEquals("'Parent' should not be a parent anymore.", 0,parent
.getHybridParentRelations().size());
416 name1
= BotanicalName
.NewInstance(getSpeciesRank());
417 name1
.addHybridChild(child
, relType
, null);
418 nameService
.save(name1
);
419 commitAndStartNewTransaction(tableNames
);
422 nameService
.delete(name1
);
423 Assert
.fail("Delete should throw an error as long as hybrid child exist.");
424 } catch (Exception e
) {
425 if (e
.getMessage().contains("Name can't be deleted as it is a parent in")){
427 endTransaction(); //exception rolls back transaction!
428 startNewTransaction();
430 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
433 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
434 Assert
.assertNotNull("Name should still be in database",name1
);
435 name1
.removeHybridChild(child
);
436 nameService
.delete(name1
); //should throw now exception
437 commitAndStartNewTransaction(tableNames
);
438 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
439 Assert
.assertNull("Name should not be in database anymore",name1
);
443 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
446 @Ignore //currently does not run in suite
447 public void testDeleteTaxonNameBaseInConcept() {
448 final String
[] tableNames
= new String
[]{"TaxonNameBase","TaxonBase"};
450 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
451 name1
.setTitleCache("Name1", true);
452 TaxonNameBase
<?
,?
> basionym
= BotanicalName
.NewInstance(getSpeciesRank());
453 basionym
.setTitleCache("basionym", true);
455 Taxon taxon
= Taxon
.NewInstance(name1
, null);
456 nameService
.save(name1
);
457 taxonService
.save(taxon
);
458 commitAndStartNewTransaction(tableNames
);
461 nameService
.delete(name1
);
462 Assert
.fail("Delete should throw an error as long as name is used in a concept.");
463 } catch (Exception e
) {
464 if (e
.getMessage().contains("Name can't be deleted as it is used in concept")){
466 endTransaction(); //exception rolls back transaction!
467 startNewTransaction();
469 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
472 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
473 Assert
.assertNotNull("Name should still be in database",name1
);
474 taxon
= (Taxon
)taxonService
.find(taxon
.getUuid());
475 Assert
.assertNotNull("Taxon should still be in database",taxon
);
476 taxon
.setName(basionym
);
477 taxonService
.save(taxon
);
478 nameService
.delete(name1
); //should throw now exception
479 commitAndStartNewTransaction(tableNames
);
480 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
481 Assert
.assertNull("Name should not be in database anymore",name1
);
482 taxon
= (Taxon
)taxonService
.find(taxon
.getUuid());
483 Assert
.assertNotNull("Taxon should still be in database",taxon
);
487 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
490 @Ignore //currently does not run in suite
491 public void testDeleteTaxonNameBaseAsStoredUnder() {
492 final String
[] tableNames
= new String
[]{"TaxonNameBase","SpecimenOrObservationBase"};
494 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
495 name1
.setTitleCache("Name1", true);
496 Specimen specimen
= Specimen
.NewInstance();
497 specimen
.setStoredUnder(name1
);
499 occurrenceService
.save(specimen
);
500 nameService
.save(name1
);
502 commitAndStartNewTransaction(tableNames
);
503 nameService
.delete(name1
);
504 Assert
.fail("Delete should throw an error as long as name is used for specimen#storedUnder.");
505 } catch (Exception e
) {
506 if (e
.getMessage().contains("Name can't be deleted as it is used as derivedUnit#storedUnder")){
508 endTransaction(); //exception rolls back transaction!
509 startNewTransaction();
511 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
514 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
515 Assert
.assertNotNull("Name should still be in database",name1
);
516 specimen
= (Specimen
)occurrenceService
.find(specimen
.getUuid());
517 Assert
.assertNotNull("Specimen should still be in database",name1
);
518 specimen
.setStoredUnder(null);
519 occurrenceService
.saveOrUpdate(specimen
);
520 nameService
.delete(name1
); //should throw now exception
521 commitAndStartNewTransaction(tableNames
);
522 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
523 Assert
.assertNull("Name should not be in database anymore",name1
);
524 specimen
= (Specimen
)occurrenceService
.find(specimen
.getUuid());
525 Assert
.assertNotNull("Specimen should still be in database",specimen
);
527 occurrenceService
.delete(specimen
); //this is to better run this test in the test suit
532 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
535 @Ignore //currently does not run in suite
536 public void testDeleteTaxonNameBaseInSource() {
537 final String
[] tableNames
= new String
[]{"TaxonNameBase","DescriptionBase","TaxonBase","OriginalSourceBase","DescriptionElementBase"};
539 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
540 name1
.setTitleCache("Name1", true);
541 TaxonNameBase
<?
,?
> taxonName
= BotanicalName
.NewInstance(getSpeciesRank());
542 taxonName
.setTitleCache("taxonName", true);
543 Taxon taxon
= Taxon
.NewInstance(taxonName
, null);
545 TaxonDescription taxonDescription
= TaxonDescription
.NewInstance(taxon
);
546 Feature feature
= (Feature
)termService
.find(Feature
.DESCRIPTION().getUuid());
547 Language lang
= (Language
)termService
.find(Language
.DEFAULT().getUuid());
548 TextData textData
= TextData
.NewInstance("Any text", lang
, null);
549 textData
.setFeature(feature
);
550 taxonDescription
.addElement(textData
);
551 DescriptionElementSource source
= DescriptionElementSource
.NewInstance(null, null, name1
, "");
552 textData
.addSource(source
);
553 taxonService
.saveOrUpdate(taxon
);
554 nameService
.save(name1
);
556 commitAndStartNewTransaction(tableNames
);
557 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
558 nameService
.delete(name1
);
559 Assert
.fail("Delete should throw an error as long as name is used in a source.");
560 } catch (Exception e
) {
561 if (e
.getMessage().contains("Name can't be deleted as it is used as descriptionElementSource#nameUsedInSource")){
563 endTransaction(); //exception rolls back transaction!
564 startNewTransaction();
566 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
569 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
570 Assert
.assertNotNull("Name should still be in database",name1
);
571 taxon
= (Taxon
)taxonService
.find(taxon
.getUuid());
572 Assert
.assertNotNull("Taxon should still be in database",name1
);
573 source
= taxon
.getDescriptions().iterator().next().getElements().iterator().next().getSources().iterator().next();
574 source
.setNameUsedInSource(null);
575 taxonService
.saveOrUpdate(taxon
);
576 nameService
.delete(name1
); //should throw now exception
577 commitAndStartNewTransaction(tableNames
);
578 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
579 Assert
.assertNull("Name should not be in database anymore",name1
);
580 taxon
= (Taxon
)taxonService
.find(taxon
.getUuid());
581 Assert
.assertNotNull("Taxon should still be in database",taxon
);
582 source
= taxon
.getDescriptions().iterator().next().getElements().iterator().next().getSources().iterator().next();
583 Assert
.assertNull("Source should not have a nameUsedInSource anymore",source
.getNameUsedInSource());
588 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
591 @Ignore //currently does not run in suite
592 public void testDeleteTaxonNameBaseAsType() {
593 final String
[] tableNames
= new String
[]{"TaxonNameBase","TypeDesignationBase","TaxonNameBase_TypeDesignationBase"};
595 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
596 name1
.setTitleCache("Name used as type", true);
598 NonViralName
<?
> higherName
= BotanicalName
.NewInstance(getGenusRank());
599 higherName
.setTitleCache("genus name", true);
600 NameTypeDesignationStatus typeStatus
= (NameTypeDesignationStatus
)termService
.find(NameTypeDesignationStatus
.AUTOMATIC().getUuid());
601 boolean addToAllHomotypicNames
= true;
602 higherName
.addNameTypeDesignation(name1
, null, null, null, typeStatus
, addToAllHomotypicNames
);
603 nameService
.save(higherName
);
605 commitAndStartNewTransaction(tableNames
);
606 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
607 nameService
.delete(name1
);
608 Assert
.fail("Delete should throw an error as long as name is used in a type designation.");
609 } catch (Exception e
) {
610 if (e
.getMessage().contains("Name can't be deleted as it is used as a name type")){
612 endTransaction(); //exception rolls back transaction!
613 startNewTransaction();
615 Assert
.fail("Unexpected error occurred when trying to delete taxon name: " + e
.getMessage());
618 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
619 Assert
.assertNotNull("Name should still be in database",name1
);
620 higherName
= (NonViralName
<?
>)nameService
.find(higherName
.getUuid());
621 higherName
.getNameTypeDesignations().iterator().next().removeType(); //keeps the designation but removes the name from it
622 // nameService.deleteTypeDesignation(higherName,commitAndStartNewTransaction(tableNames) ); //deletes the complete designation //both options can be used
623 nameService
.delete(name1
); //should throw now exception
624 commitAndStartNewTransaction(tableNames
);
625 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
626 Assert
.assertNull("Name should not be in database anymore",name1
);
627 higherName
= (NonViralName
<?
>)nameService
.find(higherName
.getUuid());
628 Assert
.assertNotNull("Higher name should still exist in database",higherName
);
629 Assert
.assertEquals("Higher name should not have type designations anymore",1, higherName
.getTypeDesignations().size());
635 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
638 @Ignore //currently does not run in suite
639 public void testDeleteTaxonNameBase() {
640 final String
[] tableNames
= new String
[]{"TaxonNameBase","NameRelationship","HybridRelationship","DescriptionBase","NomenclaturalStatus","TaxonBase","SpecimenOrObservationBase","OriginalSourceBase","DescriptionElementBase","TypeDesignationBase","TaxonNameBase_TypeDesignationBase"};
642 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
643 name1
.setTitleCache("Name1", true);
645 //TaxonNameDescription
646 name1
= BotanicalName
.NewInstance(getSpeciesRank());
647 TaxonNameDescription
.NewInstance(name1
);
648 nameService
.saveOrUpdate(name1
);
649 commitAndStartNewTransaction(tableNames
);
651 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
652 nameService
.delete(name1
); //should throw now exception
655 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
656 Assert
.assertNull("Name should not be in database anymore",name1
);
658 // printDataSet(System.out, tableNames);
661 //NomenclaturalStatus
662 name1
= BotanicalName
.NewInstance(getSpeciesRank());
663 NomenclaturalStatusType nomStatusType
= (NomenclaturalStatusType
)termService
.find(NomenclaturalStatusType
.ILLEGITIMATE().getUuid());
664 NomenclaturalStatus status
= NomenclaturalStatus
.NewInstance(nomStatusType
);
665 name1
.addStatus(status
);
666 nameService
.saveOrUpdate(name1
);
667 commitAndStartNewTransaction(tableNames
);
669 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
670 nameService
.delete(name1
); //should throw now exception
673 // printDataSet(System.out, tableNames);
677 name1
= BotanicalName
.NewInstance(getSpeciesRank());
678 name1
.setTitleCache("Name with type designation", true);
679 SpecimenTypeDesignation typeDesignation
= SpecimenTypeDesignation
.NewInstance();
680 SpecimenTypeDesignationStatus typeStatus
= (SpecimenTypeDesignationStatus
)termService
.find(SpecimenTypeDesignationStatus
.HOLOTYPE().getUuid());
681 typeDesignation
.setTypeStatus(typeStatus
);
682 Specimen specimen
= Specimen
.NewInstance();
683 specimen
.setTitleCache("Type specimen", true);
684 occurrenceService
.save(specimen
);
685 typeDesignation
.setTypeSpecimen(specimen
);
687 name1
.addTypeDesignation(typeDesignation
, true);
688 nameService
.save(name1
);
689 commitAndStartNewTransaction(tableNames
);
690 // printDataSet(System.out, tableNames);
692 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
693 nameService
.delete(name1
); //should throw now exception
696 // printDataSet(System.out, tableNames);
701 * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.
704 @Ignore //currently does not run in suite
705 public void testDeleteTaxonNameBaseWithTypeInHomotypicalGroup() {
706 final String
[] tableNames
= new String
[]{"TaxonNameBase","NameRelationship","HybridRelationship","DescriptionBase","NomenclaturalStatus","TaxonBase","SpecimenOrObservationBase","OriginalSourceBase","DescriptionElementBase","TypeDesignationBase","TaxonNameBase_TypeDesignationBase"};
708 //Type Designations for homotypical group with > 1 names
709 NonViralName
<?
> name1
= BotanicalName
.NewInstance(getSpeciesRank());
710 name1
.setTitleCache("Name1 with type designation", true);
711 NonViralName
<?
> name2
= BotanicalName
.NewInstance(getSpeciesRank());
712 name2
.setTitleCache("Name2 with type designation", true);
713 name2
.setHomotypicalGroup(name1
.getHomotypicalGroup());
715 Specimen specimen
= Specimen
.NewInstance();
716 specimen
.setTitleCache("Type specimen 2", true);
717 occurrenceService
.save(specimen
);
718 SpecimenTypeDesignationStatus typeStatus
= (SpecimenTypeDesignationStatus
)termService
.find(SpecimenTypeDesignationStatus
.HOLOTYPE().getUuid());
720 SpecimenTypeDesignation typeDesignation
= SpecimenTypeDesignation
.NewInstance();
721 typeDesignation
.setTypeStatus(typeStatus
);
722 typeDesignation
.setTypeSpecimen(specimen
);
724 boolean addToAllNames
= true;
725 name1
.addTypeDesignation(typeDesignation
, addToAllNames
);
726 nameService
.saveOrUpdate(name1
);
727 commitAndStartNewTransaction(tableNames
);
729 name1
= (NonViralName
<?
>)nameService
.find(name1
.getUuid());
730 nameService
.delete(name1
); //should throw now exception
733 // printDataSet(System.out, tableNames);
738 @DataSet(loadStrategy
=CleanSweepInsertLoadStrategy
.class)
739 public void testDeleteTypeDesignation() {
740 final String
[] tableNames
= new String
[]{
741 "TaxonNameBase","TypeDesignationBase","TaxonNameBase_TypeDesignationBase",
742 "SpecimenOrObservationBase"};
744 // BotanicalName name1 = BotanicalName.NewInstance(getSpeciesRank());
745 // name1.setTitleCache("Name1");
746 // name1.setUuid(UUID.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
748 // BotanicalName name2 = BotanicalName.NewInstance(getSpeciesRank());
749 // name2.setTitleCache("Name2");
750 // name2.setUuid(UUID.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
752 // BotanicalName name3 = BotanicalName.NewInstance(getGenusRank());
753 // name3.setTitleCache("Name3");
754 // name3.setUuid(UUID.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
757 // SpecimenTypeDesignation desig1 = SpecimenTypeDesignation.NewInstance();
758 // desig1.setUuid(UUID.fromString("1357c307-00c3-499c-8e20-0849d4706125"));
759 // name1.addTypeDesignation(desig1, true);
760 // name2.addTypeDesignation(desig1, true);
762 // SpecimenTypeDesignation desig2 = SpecimenTypeDesignation.NewInstance();
763 // desig2.setUuid(UUID.fromString("9bbda70b-7272-4e65-a807-852a3f2eba63"));
764 // name1.addTypeDesignation(desig2, true);
766 // Specimen specimen1 = Specimen.NewInstance();
767 // Fossil specimen2 = Fossil.NewInstance();
769 // desig1.setTypeSpecimen(specimen1);
770 // desig2.setTypeSpecimen(specimen2);
772 // NameTypeDesignation nameDesig = NameTypeDesignation.NewInstance();
773 // nameDesig.setTypeName(name1);
774 // name3.addTypeDesignation(nameDesig, true);
776 // nameService.save(name1);
777 // nameService.save(name2);
778 // nameService.save(name3);
780 // commitAndStartNewTransaction(tableNames);
782 // printDataSet(System.out, tableNames);
786 TaxonNameBase name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
787 TaxonNameBase name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
788 TaxonNameBase name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
789 Specimen specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
790 Fossil fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
792 Set
<TypeDesignationBase
> desigs1
= name1
.getTypeDesignations();
793 Set
<TypeDesignationBase
> desigs2
= name2
.getTypeDesignations();
794 Set
<TypeDesignationBase
> desigs3
= name3
.getTypeDesignations();
796 Assert
.assertEquals("name1 should have 2 type designations", 2, desigs1
.size());
797 Assert
.assertEquals("name2 should have 1 type designations", 1, desigs2
.size());
798 Assert
.assertEquals("name3 should have 1 type designations", 1, desigs3
.size());
799 Assert
.assertEquals("Specimen1 should be used in 1 type designation", 1, specimen1
.getSpecimenTypeDesignations().size());
800 Assert
.assertEquals("Fossil should be used in 1 type designation", 1, fossil
.getSpecimenTypeDesignations().size());
802 nameService
.deleteTypeDesignation(null, null);
804 commitAndStartNewTransaction(tableNames
);
806 name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
807 name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
808 name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
809 specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
810 fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
812 desigs1
= name1
.getTypeDesignations();
813 desigs2
= name2
.getTypeDesignations();
814 desigs3
= name3
.getTypeDesignations();
816 Assert
.assertEquals("name1 should have 2 type designations", 2, desigs1
.size());
817 Assert
.assertEquals("name2 should have 1 type designations", 1, desigs2
.size());
818 Assert
.assertEquals("name3 should have 1 type designations", 1, desigs3
.size());
819 Assert
.assertEquals("Specimen1 should be used in 1 type designation", 1, specimen1
.getSpecimenTypeDesignations().size());
820 Assert
.assertEquals("Fossil should be used in 1 type designation", 1, fossil
.getSpecimenTypeDesignations().size());
822 nameService
.deleteTypeDesignation(name1
, null);
824 commitAndStartNewTransaction(tableNames
);
826 name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
827 name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
828 name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
829 specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
830 fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
832 desigs1
= name1
.getTypeDesignations();
833 desigs2
= name2
.getTypeDesignations();
834 desigs3
= name3
.getTypeDesignations();
836 Assert
.assertEquals("name1 should have 0 type designations", 0, desigs1
.size());
837 Assert
.assertEquals("name2 should have 1 type designations", 1, desigs2
.size());
838 Assert
.assertEquals("name3 should have 1 type designations", 1, desigs3
.size());
839 Assert
.assertEquals("Specimen1 should be used in 1 type designation", 1, specimen1
.getSpecimenTypeDesignations().size());
840 Assert
.assertEquals("Fossil should be used in 0 type designation", 0, fossil
.getSpecimenTypeDesignations().size());
842 SpecimenTypeDesignation desig2
= (SpecimenTypeDesignation
)name2
.getTypeDesignations().iterator().next();
843 nameService
.deleteTypeDesignation(name2
, desig2
);
845 commitAndStartNewTransaction(tableNames
);
847 name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
848 name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
849 name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
850 specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
851 fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
853 desigs1
= name1
.getTypeDesignations();
854 desigs2
= name2
.getTypeDesignations();
855 desigs3
= name3
.getTypeDesignations();
857 Assert
.assertEquals("name1 should have 0 type designations", 0, desigs1
.size());
858 Assert
.assertEquals("name2 should have 0 type designations", 0, desigs2
.size());
859 Assert
.assertEquals("name3 should have 1 type designations", 1, desigs3
.size());
860 Assert
.assertEquals("Specimen1 should be used in 0 type designation", 0, specimen1
.getSpecimenTypeDesignations().size());
861 Assert
.assertEquals("Fossil should be used in 0 type designation", 0, fossil
.getSpecimenTypeDesignations().size());
863 NameTypeDesignation desig3
= (NameTypeDesignation
)name3
.getTypeDesignations().iterator().next();
864 nameService
.deleteTypeDesignation(name3
, desig3
);
866 commitAndStartNewTransaction(tableNames
);
868 name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
869 name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
870 name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
871 specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
872 fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
874 desigs1
= name1
.getTypeDesignations();
875 desigs2
= name2
.getTypeDesignations();
876 desigs3
= name3
.getTypeDesignations();
878 Assert
.assertEquals("name1 should have 0 type designations", 0, desigs1
.size());
879 Assert
.assertEquals("name2 should have 0 type designations", 0, desigs2
.size());
880 Assert
.assertEquals("name3 should have 0 type designations", 0, desigs3
.size());
881 Assert
.assertEquals("Specimen1 should be used in 0 type designation", 0, specimen1
.getSpecimenTypeDesignations().size());
882 Assert
.assertEquals("Fossil should be used in 0 type designation", 0, fossil
.getSpecimenTypeDesignations().size());
888 public void testDeleteTypeDesignationAllNames() {
889 final String
[] tableNames
= new String
[]{
890 "TaxonNameBase","TypeDesignationBase",
891 "TaxonNameBase_TypeDesignationBase","SpecimenOrObservationBase"};
894 TaxonNameBase name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
895 TaxonNameBase name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
896 TaxonNameBase name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
897 Specimen specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
898 Fossil fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
900 Set
<TypeDesignationBase
> desigs1
= name1
.getTypeDesignations();
901 Set
<TypeDesignationBase
> desigs2
= name2
.getTypeDesignations();
902 Set
<TypeDesignationBase
> desigs3
= name3
.getTypeDesignations();
904 Assert
.assertEquals("name1 should have 2 type designations", 2, desigs1
.size());
905 Assert
.assertEquals("name2 should have 1 type designations", 1, desigs2
.size());
906 Assert
.assertEquals("name3 should have 1 type designations", 1, desigs3
.size());
907 Assert
.assertEquals("Specimen1 should be used in 1 type designation", 1, specimen1
.getSpecimenTypeDesignations().size());
908 Assert
.assertEquals("Fossil should be used in 1 type designation", 1, fossil
.getSpecimenTypeDesignations().size());
910 SpecimenTypeDesignation desig2
= (SpecimenTypeDesignation
)name2
.getTypeDesignations().iterator().next();
912 nameService
.deleteTypeDesignation(null, desig2
);
914 commitAndStartNewTransaction(tableNames
);
916 name1
= this.nameService
.load(UUID
.fromString("6dbd41d1-fe13-4d9c-bb58-31f051c2c384"));
917 name2
= this.nameService
.load(UUID
.fromString("f9e9c13f-5fa5-48d3-88cf-712c921a099e"));
918 name3
= this.nameService
.load(UUID
.fromString("e1e66264-f16a-4df9-80fd-6ab5028a3c28"));
919 specimen1
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("0d19a9ca-21a7-4adb-8640-8d6719e15eea")),Specimen
.class);
920 fossil
= CdmBase
.deproxy(this.occurrenceService
.load(UUID
.fromString("4c48b7c8-4c8d-4e48-b083-0837fe51a0a9")),Fossil
.class);
922 desigs1
= name1
.getTypeDesignations();
923 desigs2
= name2
.getTypeDesignations();
924 desigs3
= name3
.getTypeDesignations();
926 Assert
.assertEquals("name1 should have 1 type designations", 1, desigs1
.size());
927 Assert
.assertEquals("name2 should have 0 type designations", 0, desigs2
.size());
928 Assert
.assertEquals("name3 should have 1 type designations", 1, desigs3
.size());
929 Assert
.assertEquals("Specimen1 should be used in 0 type designation", 0, specimen1
.getSpecimenTypeDesignations().size());
930 Assert
.assertEquals("Fossil should be used in 1 type designation", 1, fossil
.getSpecimenTypeDesignations().size());
937 private Rank
getSpeciesRank() {
938 return (Rank
)termService
.find(Rank
.uuidSpecies
);
944 private Rank
getGenusRank() {
945 return (Rank
)termService
.find(Rank
.uuidGenus
);