1 16 17 package org.springframework.core; 18 19 import junit.framework.TestCase; 20 21 24 public abstract class AbstractControlFlowTests extends TestCase { 25 26 protected abstract ControlFlow createControlFlow(); 27 28 31 public void testUnderClassAndMethod() { 32 new One().test(); 33 new Two().testing(); 34 } 35 36 44 45 46 public class One { 47 public void test() { 48 ControlFlow cflow = createControlFlow(); 49 assertTrue(cflow.under(One.class)); 50 assertTrue(cflow.under(AbstractControlFlowTests.class)); 51 assertFalse(cflow.under(Two.class)); 52 assertTrue(cflow.under(One.class, "test")); 53 assertFalse(cflow.under(One.class, "hashCode")); 54 } 55 56 } 57 58 public class Two { 59 public void testing() { 60 ControlFlow cflow = createControlFlow(); 61 assertTrue(cflow.under(Two.class)); 62 assertTrue(cflow.under(AbstractControlFlowTests.class)); 63 assertFalse(cflow.under(One.class)); 64 assertFalse(cflow.under(Two.class, "test")); 65 assertTrue(cflow.under(Two.class, "testing")); 66 } 67 } 68 } 69 | Popular Tags |