1 15 package org.apache.tapestry.annotations; 16 17 import java.lang.reflect.Method ; 18 19 import org.apache.hivemind.ClassResolver; 20 import org.apache.hivemind.Resource; 21 import org.apache.hivemind.test.HiveMindTestCase; 22 import org.apache.hivemind.util.ClasspathResource; 23 import org.apache.tapestry.enhance.EnhancementOperation; 24 import org.apache.tapestry.spec.IComponentSpecification; 25 26 30 31 public abstract class BaseAnnotationTestCase extends HiveMindTestCase 32 { 33 34 protected Method findMethod(Class clazz, String name) 35 { 36 for (Method m : clazz.getMethods()) 37 { 38 if (m.getName().equals(name)) 39 return m; 40 } 41 42 throw new IllegalArgumentException ("No method " + name + " in " + clazz); 43 } 44 45 protected IComponentSpecification newSpec() 46 { 47 return (IComponentSpecification) newMock(IComponentSpecification.class); 48 } 49 50 protected EnhancementOperation newOp() 51 { 52 return (EnhancementOperation) newMock(EnhancementOperation.class); 53 } 54 55 protected Resource newResource(ClassResolver resolver, Class clazz) 56 { 57 return new ClasspathResource(resolver, clazz.getName().replace('.', '/')); 58 } 59 60 } 61 | Popular Tags |