1 8 package test; 9 10 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 11 import junit.framework.TestCase; 12 13 19 public class ComplexCFlowTest extends TestCase { 20 21 private static String s_logString = ""; 22 23 30 public void testComplexNotCFlow_2() { 31 s_logString = ""; 32 method2(); 33 assertEquals(s_logString, " method2 method4"); 34 } 35 36 public void testComplexNotCFlow_3() { 37 s_logString = ""; 38 method3(); 39 assertEquals(s_logString, " method3 method4"); 40 } 41 42 44 public static class Aspect { 45 46 53 public void method4NotIn2Or3Advice(JoinPoint joinPoint) { 54 s_logString += " 4-!2-!3-Advice"; 55 } 56 } 57 58 60 public static void main(String [] args) { 61 junit.textui.TestRunner.run(suite()); 62 } 63 64 public static junit.framework.Test suite() { 65 return new junit.framework.TestSuite(ComplexCFlowTest.class); 66 } 67 68 70 public static void method1() { 71 s_logString += " method1"; 72 method4(); 73 } 74 75 public static void method2() { 76 s_logString += " method2"; 77 method4(); 78 } 79 80 public static void method3() { 81 s_logString += " method3"; 82 method4(); 83 } 84 85 public static void method4() { 86 s_logString += " method4"; 87 } 88 89 90 } 91 | Popular Tags |