1 15 package org.apache.tapestry.resolver; 16 17 import java.net.URL ; 18 19 import org.apache.commons.logging.Log; 20 import org.apache.hivemind.Resource; 21 import org.apache.hivemind.test.HiveMindTestCase; 22 import org.apache.hivemind.util.URLResource; 23 import org.apache.tapestry.IRequestCycle; 24 import org.apache.tapestry.spec.IComponentSpecification; 25 import org.easymock.MockControl; 26 27 33 public abstract class AbstractSpecificationResolverTestCase extends HiveMindTestCase 34 { 35 36 protected IComponentSpecification newSpecification() 37 { 38 return (IComponentSpecification) newMock(IComponentSpecification.class); 39 } 40 41 protected IRequestCycle newCycle() 42 { 43 return (IRequestCycle) newMock(IRequestCycle.class); 44 } 45 46 protected URL newURL(String file) 47 { 48 return getClass().getResource(file); 49 } 50 51 protected Resource newResource(URL url) 52 { 53 MockControl control = newControl(Resource.class); 54 Resource resource = (Resource) control.getMock(); 55 56 resource.getResourceURL(); 57 control.setReturnValue(url); 58 59 return resource; 60 } 61 62 protected Resource newResource(String path) 63 { 64 return new URLResource(newURL(path)); 65 } 66 67 protected void train(Log log, MockControl control, String message) 68 { 69 log.isDebugEnabled(); 70 control.setReturnValue(true); 71 72 log.debug(message); 73 } 74 75 } | Popular Tags |