use of eu.etaxonomy.cdm.persistence.dto.TaxonNodeDtoByNameComparator in project cdmlib by cybertaxonomy.
the class TaxonNodeDtoByNameComparatorTest method testNullSave.
@Test
public void testNullSave() {
Classification classification = Classification.NewInstance("Greuther, 1993");
Reference sec = ReferenceFactory.newBook();
IBotanicalName botname_1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
String nameCache_1 = "Epilobium \u00D7aschersonianum Hausskn.";
botname_1.setNameCache(nameCache_1, true);
Taxon taxon_1 = Taxon.NewInstance(botname_1, sec);
IBotanicalName botname_2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
String nameCache_2 = "\u00D7Epilobium \u00D7angustifolium";
botname_2.setNameCache(nameCache_2, true);
Taxon taxon_2 = Taxon.NewInstance(botname_2, sec);
TaxonNodeDto node1 = new TaxonNodeDto(classification.addChildTaxon(taxon_1, sec, null));
TaxonNodeDto node2 = new TaxonNodeDto(classification.addChildTaxon(taxon_2, sec, null));
TaxonNodeDtoByNameComparator taxonNodeByNameComparator = new TaxonNodeDtoByNameComparator();
Assert.assertEquals(0, taxonNodeByNameComparator.compare(null, null));
Assert.assertEquals(-1, taxonNodeByNameComparator.compare(node1, null));
Assert.assertEquals(1, taxonNodeByNameComparator.compare(null, node1));
}
Aggregations