Project

General

Profile

« Previous | Next » 

Revision 6ab31377

Added by Andreas Müller over 13 years ago

Added new rank "unranked" (#2141) and updated language labels and titleCaches with full language name (#2144)

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategyTest.java
62 62
	private INomenclaturalAuthor basAuthor;
63 63
	private INomenclaturalAuthor exBasAuthor;
64 64
	private Reference citationRef;
65
	private ReferenceFactory refFactory;
66 65
	
67 66
	@BeforeClass
68 67
	public static void setUpBeforeClass() {
......
75 74
	 */
76 75
	@Before
77 76
	public void setUp() throws Exception {
78
		refFactory = ReferenceFactory.newInstance();
79 77
		strategy = NonViralNameDefaultCacheStrategy.NewInstance();
80 78
		familyName = BotanicalName.PARSED_NAME(familyNameString, Rank.FAMILY());
81 79
		genusName = BotanicalName.PARSED_NAME(genusNameString, Rank.GENUS());
......
136 134
		specName.setGenusOrUninomial("Genus");
137 135
		specName.setSpecificEpithet("");
138 136
		assertEquals("Empty species string must not result in trailing whitespace", "Genus", specName.getNameCache());
137

  
138
		//unranked taxa
139
		String unrankedCache;
140
		BotanicalName unrankedName = BotanicalName.NewInstance(Rank.UNRANKED());
141
		unrankedName.setGenusOrUninomial("Genus");
142
		NonViralNameDefaultCacheStrategy<BotanicalName> strategy = NonViralNameDefaultCacheStrategy.NewInstance();
143
			//infraspecific
144
		unrankedName.setInfraSpecificEpithet("infraspecific");
145
		unrankedName.setSpecificEpithet("species");
146
		unrankedCache = strategy.getNameCache(unrankedName);
147
		
148
		Assert.assertEquals("Correct unranked cache expected", "Genus species [unranked] infraspecific", unrankedCache);
149
		
150
			//infrageneric
151
		unrankedName.setInfraSpecificEpithet(null);
152
		unrankedName.setSpecificEpithet(null);
153
		unrankedName.setInfraGenericEpithet("Infrageneric");
154
		unrankedCache = strategy.getNameCache(unrankedName);
155
		Assert.assertEquals("Correct unranked cache expected", "Genus [unranked] Infrageneric", unrankedCache);
156
		
139 157
		
140 158
	}
141 159
	
......
185 203
	
186 204
	@Test
187 205
	public void testCacheListener() {
188
		Reference ref = refFactory.newGeneric();
206
		Reference ref = ReferenceFactory.newGeneric();
189 207
		ref.setTitleCache("GenericRef",true);
190 208
		this.subSpeciesName.setNomenclaturalReference(ref);
191 209
		Assert.assertEquals("Expected full title cache has error", "Abies alba subsp. beta, GenericRef", subSpeciesName.getFullTitleCache());
......
283 301
		
284 302
		
285 303
		//ref + nomRef
286
		Reference book = refFactory.newBook();
304
		Reference book = ReferenceFactory.newBook();
287 305
		book.setTitle("Booktitle");
288 306
		Assert.assertNotNull("TitleCache should not be null", subSpeciesName.getTitleCache());
289 307
		subSpeciesName.setNomenclaturalReference(book);
......
384 402
	}
385 403
	
386 404
	@Test
387
	public void testGetInfraGericNames(){
405
	public void testGetInfraGenericNames(){
388 406
		String author = "Anyauthor";
389 407
		NonViralName nonViralName = NonViralName.NewInstance(Rank.SUBGENUS());
390 408
		nonViralName.setGenusOrUninomial("Genus");

Also available in: Unified diff