1 7 package ch.ethz.prose.crosscut; 8 9 import java.util.Vector ; 11 12 import junit.framework.*; 13 import ch.ethz.prose.ProseSystem; 14 import ch.ethz.prose.filter.PointCutter; 15 16 22 public 23 class AllLocationsTest extends TestCase { 24 25 static class AllLocationsExample extends MethodCut 27 { 28 protected PointCutter pointCutter() 29 { 30 return null; 31 } 32 33 public void METHOD_ARGS() {} 34 35 public CrosscutRequest doCreateRequest(Class c) 36 { 37 return super.doCreateRequest(c); 38 } 39 }; 40 41 static class ExampleClass 42 { 43 public void method1() {} 44 public void method2() 45 { 46 System.err.println("method 2"); 47 } 48 protected void method3() {} 49 void method4(){} 50 } 51 52 AllLocationsExample testCrosscut = null; 53 57 public AllLocationsTest(String name) 58 { 59 super(name); 60 } 61 62 63 66 protected 67 void setUp() throws Exception 68 { 69 try 70 { ProseSystem.startup(); 71 testCrosscut = new AllLocationsExample(); 72 testCrosscut.insertionAction(true); 74 testCrosscut.insertionAction(false); 75 } 76 catch (Exception e) 77 { 78 e.printStackTrace(); 79 Assert.fail("ProseSystem.startup() failed"); 80 } 81 } 82 83 protected 84 void tearDown() 85 { 86 try 87 { ProseSystem.teardown(); } 88 catch (Exception e) 89 { Assert.fail("ProseSystem.teardown() failed"); } 90 } 91 92 public void testDoCreateRequest() throws Exception 93 { 94 assertNotNull(testCrosscut.doCreateRequest(Vector .class)); 95 assertTrue("some public methods in there", testCrosscut.doCreateRequest(Vector .class).size() > 0); 96 101 assertTrue("Class testClass has exactly 8 crosscut points", testCrosscut.doCreateRequest(ExampleClass.class).size() == 8); 102 } 103 104 108 public static 109 Test suite() 110 { 111 return new TestSuite(AllLocationsTest.class); 112 } 113 114 115 } 116 117 118 | Popular Tags |