Project

General

Profile

« Previous | Next » 

Revision 04511378

Added by Andreas Müller over 13 years ago

hybrid parsing and caching for monom, binom and trinom flags implemented

View differences:

cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java
87 87
		termInitializer.initialize();
88 88
	}
89 89

  
90
	/**
91
	 * @throws java.lang.Exception
92
	 */
93
	@AfterClass
94
	public static void tearDownAfterClass() throws Exception {
95
	}
96 90

  
97 91
	/**
98 92
	 * @throws java.lang.Exception
......
103 97
		botanicCode = NomenclaturalCode.ICBN;
104 98
	}
105 99

  
106
	/**
107
	 * @throws java.lang.Exception
108
	 */
109
	@After
110
	public void tearDown() throws Exception {
111
	}
112 100

  
113 101
/*************** TEST *********************************************/
114 102
	
......
286 274
		assertEquals("Basionym author should have 3 authors", 3, ((Team)authorname.getExBasionymAuthorTeam()).getTeamMembers().size());
287 275
	}
288 276
	
277
	/**
278
	 * Test method for {@link eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl#parseFullName(java.lang.String, eu.etaxonomy.cdm.model.name.Rank)}.
279
	 */
280
	@Test
281
	public final void testHybrids() {
282
		try {
283
			Method parseMethod = parser.getClass().getDeclaredMethod("parseFullName", String.class, NomenclaturalCode.class, Rank.class);
284
			testName_StringNomcodeRank(parseMethod);
285
		} catch (Exception e) {
286
			e.printStackTrace();
287
			assertTrue(false);
288
		}
289
		
290
		//Species hybrid
291
//		NonViralName nameTeam1 = parser.parseFullName("Aegilops ?insulae-cypri H. Scholz");
292
		NonViralName name1 = parser.parseFullName("Aegilops ?insulae Scholz", botanicCode, null);
293
		assertTrue("Name must have binom hybrid bit set", name1.isBinomHybrid());
294
		assertFalse("Name must not have monom hybrid bit set", name1.isMonomHybrid());
295
		assertFalse("Name must not have trinom hybrid bit set", name1.isTrinomHybrid());
296
		assertEquals("Species epithet must be 'insulae'", "insulae", name1.getSpecificEpithet());
297
		
298
		//Uninomial hybrid
299
		name1 = parser.parseFullName("x Aegilops Scholz", botanicCode, null);
300
		assertTrue("Name must have monom hybrid bit set", name1.isMonomHybrid());
301
		assertFalse("Name must not have binom hybrid bit set", name1.isBinomHybrid());
302
		assertFalse("Name must not have trinom hybrid bit set", name1.isTrinomHybrid());
303
		assertEquals("Uninomial must be 'Aegilops'", "Aegilops", name1.getGenusOrUninomial());
304

  
305
		//Species hybrid
306
		name1 = parser.parseFullName("Aegilops insulae subsp. X abies Scholz", botanicCode, null);
307
		assertFalse("Name must not have monom hybrid bit set", name1.isMonomHybrid());
308
		assertFalse("Name must not have binom hybrid bit set", name1.isBinomHybrid());
309
		assertTrue("Name must have trinom hybrid bit set", name1.isTrinomHybrid());
310
		assertEquals("Infraspecific epithet must be 'abies'", "abies", name1.getInfraSpecificEpithet());
311

  
312
	}
313
	
289 314
	private void testName_StringNomcodeRank(Method parseMethod) 
290 315
			throws InvocationTargetException, IllegalAccessException  {
291 316
		NonViralName name1 = (NonViralName)parseMethod.invoke(parser, strNameAbies1, null, Rank.SPECIES());
......
747 772

  
748 773
	}
749 774
	
775
	
776
	
750 777
	/**
751 778
	 * @param testParsable
752 779
	 * @param icbn

Also available in: Unified diff