KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > aop > annotated > declare > AnnotatedDeclareTestCase


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package org.jboss.test.aop.annotated.declare;
9
10 import java.util.ArrayList JavaDoc;
11
12 import junit.framework.Test;
13 import junit.framework.TestCase;
14 import junit.framework.TestSuite;
15 import junit.textui.TestRunner;
16
17
18 /**
19  *
20  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
21  * @version $Revision: 1.1.8.2 $
22  */

23 public class AnnotatedDeclareTestCase extends TestCase
24 {
25    public static void main(String JavaDoc[] 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 JavaDoc name)
38    {
39       super(name);
40    }
41
42    protected void setUp() throws Exception JavaDoc
43    {
44    }
45    
46    public void testLoadtimeAnnotatedDeclare()throws Exception JavaDoc
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 JavaDoc actual = out.getWarnings();
56          assertEquals("Wrong number of warnings generated", 1, actual.size());
57          String JavaDoc s = (String JavaDoc)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