2 package eu
.etaxonomy
.cdm
.persistence
.dao
;
4 import static org
.junit
.Assert
.*;
6 import java
.lang
.reflect
.Method
;
8 import org
.apache
.log4j
.Logger
;
9 import org
.junit
.Before
;
10 import org
.junit
.Test
;
12 import eu
.etaxonomy
.cdm
.model
.name
.BotanicalName
;
13 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
14 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
15 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
17 public class MethodCacheImplTest
{
18 @SuppressWarnings("unused")
19 private static final Logger logger
= Logger
.getLogger(MethodCacheImplTest
.class);
21 private BotanicalName botanicalName
;
23 IMethodCache methodCache
;
24 private Reference
<?
> nomenclaturalReference
;
27 public void setUp() throws Exception
{
28 methodCache
= new MethodCacheImpl();
29 taxon
= Taxon
.NewInstance(null, null);
30 botanicalName
= BotanicalName
.NewInstance(null);
31 nomenclaturalReference
= ReferenceFactory
.newBook();
35 * Test for a method that is not declared by the class, but by the superclass
36 * also the parameter of the matching method is more generic than the given parameter
39 public void testGetMethod() {
40 Method method
= methodCache
.getMethod(taxon
.getClass(), "setName", botanicalName
.getClass());
41 assertNotNull("Method should exist", method
);
45 public void testGetMethodWhereMethodParameterIsInterface(){
46 Method method
= methodCache
.getMethod(botanicalName
.getClass(), "setNomenclaturalReference", nomenclaturalReference
.getClass());
47 assertNotNull("Method should exist", method
);