Revision e549f3ff
Added by Andreas Müller over 12 years ago
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/ZoologicalNameCacheStrategyTest.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import java.lang.reflect.InvocationTargetException; |
17 | 17 |
import java.lang.reflect.Method; |
18 |
import java.util.List; |
|
18 | 19 |
|
19 | 20 |
import org.apache.log4j.Logger; |
20 | 21 |
import org.junit.Before; |
... | ... | |
27 | 28 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
28 | 29 |
import eu.etaxonomy.cdm.model.name.Rank; |
29 | 30 |
import eu.etaxonomy.cdm.model.name.ZoologicalName; |
31 |
import eu.etaxonomy.cdm.strategy.TaggedText; |
|
30 | 32 |
|
31 | 33 |
/** |
32 | 34 |
* @author a.mueller |
... | ... | |
35 | 37 |
public class ZoologicalNameCacheStrategyTest { |
36 | 38 |
private static final Logger logger = Logger.getLogger(ZoologicalNameCacheStrategyTest.class); |
37 | 39 |
|
38 |
private ZooNameDefaultCacheStrategy strategy; |
|
40 |
private ZooNameDefaultCacheStrategy<ZoologicalName> strategy;
|
|
39 | 41 |
private ZoologicalName familyName; |
40 | 42 |
private ZoologicalName genusName; |
41 | 43 |
private ZoologicalName subGenusName; |
... | ... | |
193 | 195 |
* Test method for {@link eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy#getInfraGenusNameCache(eu.etaxonomy.cdm.model.name.BotanicalName)}. |
194 | 196 |
*/ |
195 | 197 |
@Test |
196 |
public final void testGetInfraGenusNameCache() { |
|
197 |
String methodName = "getInfraGenusNameCache"; |
|
198 |
public final void testGetInfraGenusTaggedNameCache() {
|
|
199 |
String methodName = "getInfraGenusTaggedNameCache";
|
|
198 | 200 |
Method method = getMethod(NonViralNameDefaultCacheStrategy.class, methodName, NonViralName.class); |
199 | 201 |
|
200 | 202 |
this.getValue(method, strategy, subGenusName); |
... | ... | |
242 | 244 |
protected Method getMethod(Class clazz, String methodName, Class paramClazzes){ |
243 | 245 |
Method method; |
244 | 246 |
try { |
245 |
method = clazz.getDeclaredMethod("getInfraGenusNameCache", paramClazzes);
|
|
247 |
method = clazz.getDeclaredMethod(methodName, paramClazzes);
|
|
246 | 248 |
} catch (SecurityException e) { |
247 | 249 |
logger.error("SecurityException " + e.getMessage()); |
248 | 250 |
return null; |
... | ... | |
255 | 257 |
|
256 | 258 |
protected String getValue(Method method, Object object,Object parameter){ |
257 | 259 |
try { |
258 |
return (String)method.invoke(object, parameter); |
|
260 |
List<TaggedText> list = (List<TaggedText>)method.invoke(object, parameter); |
|
261 |
return NonViralNameDefaultCacheStrategy.createString(list); |
|
259 | 262 |
} catch (IllegalArgumentException e) { |
260 | 263 |
logger.error("IllegalArgumentException " + e.getMessage()); |
261 | 264 |
return null; |
Also available in: Unified diff
fixing bugs in test for botanicalNameCacheStrategy and zoologicalNameCacheStrategy