1 15 package org.apache.tapestry.enhance; 16 17 import org.apache.hivemind.ErrorLog; 18 import org.apache.hivemind.Location; 19 import org.apache.hivemind.test.HiveMindTestCase; 20 import org.apache.tapestry.spec.IComponentSpecification; 21 import org.easymock.MockControl; 22 23 29 public class TestEnhancedClassValidator extends HiveMindTestCase 30 { 31 public static abstract class AbstractBase 32 { 33 public abstract void foo(); 34 } 35 36 public static abstract class Incomplete extends AbstractBase 37 { 38 public void bar() 39 { 40 } 42 } 43 44 public static class Complete extends AbstractBase 45 { 46 public void foo() 47 { 48 } 50 } 51 52 56 57 public void testComplete() 58 { 59 EnhancedClassValidator v = new EnhancedClassValidatorImpl(); 60 61 v.validate(AbstractBase.class, Complete.class, null); 62 } 63 64 69 70 public void testIncomplete() 71 { 72 ErrorLog log = (ErrorLog) newMock(ErrorLog.class); 73 Location l = fabricateLocation(11); 74 75 MockControl specControl = newControl(IComponentSpecification.class); 76 IComponentSpecification spec = (IComponentSpecification) specControl.getMock(); 77 78 spec.getLocation(); 79 specControl.setReturnValue(l); 80 81 log 82 .error( 83 "Method 'public abstract void org.apache.tapestry.enhance.TestEnhancedClassValidator$AbstractBase.foo()' (declared in class org.apache.tapestry.enhance.TestEnhancedClassValidator$AbstractBase) has no implementation in class org.apache.tapestry.enhance.TestEnhancedClassValidator$AbstractBase (or enhanced subclass org.apache.tapestry.enhance.TestEnhancedClassValidator$Incomplete).", 84 l, 85 null); 86 87 replayControls(); 88 89 EnhancedClassValidatorImpl v = new EnhancedClassValidatorImpl(); 90 v.setErrorLog(log); 91 92 v.validate(AbstractBase.class, Incomplete.class, spec); 93 94 verifyControls(); 95 } 96 97 101 102 public void testObject() 103 { 104 EnhancedClassValidator v = new EnhancedClassValidatorImpl(); 105 106 v.validate(Object .class, Object .class, null); 107 } 108 } | Popular Tags |