1 7 8 package org.jboss.test.aop.annotated.declare; 9 10 import java.util.ArrayList ; 11 12 import junit.framework.Test; 13 import junit.framework.TestCase; 14 import junit.framework.TestSuite; 15 import junit.textui.TestRunner; 16 17 18 23 public class AnnotatedDeclareTestCase extends TestCase 24 { 25 public static void main(String [] args) 26 { 27 TestRunner.run(suite()); 28 } 29 30 public static Test suite() 31 { 32 TestSuite suite = new TestSuite("AnnotatedDeclareTestCase"); 33 suite.addTestSuite(AnnotatedDeclareTestCase.class); 34 return suite; 35 } 36 37 public AnnotatedDeclareTestCase(String name) 38 { 39 super(name); 40 } 41 42 protected void setUp() throws Exception 43 { 44 } 45 46 public void testLoadtimeAnnotatedDeclare()throws Exception 47 { 48 System.out.println("*** testLoadtimeAnnotatedDeclare"); 49 SystemOutDecorator out = null; 50 try 51 { 52 out = SystemOutDecorator.initialise(); 53 POJO pojo = new POJO(); 54 pojo.someMethod(); 55 ArrayList actual = out.getWarnings(); 56 assertEquals("Wrong number of warnings generated", 1, actual.size()); 57 String s = (String )actual.get(0); 58 assertTrue("Warning does not end with the expected \"Expected annotated warning\"", s.endsWith("Expected annotated warning\n")); 59 } 60 finally 61 { 62 out.kill(); 63 } 64 } 65 66 } 67 | Popular Tags |