KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > core > AbstractControlFlowTests


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.core;
18
19 import junit.framework.TestCase;
20
21 /**
22  * @author Rod Johnson
23  */

24 public abstract class AbstractControlFlowTests extends TestCase {
25
26     protected abstract ControlFlow createControlFlow();
27
28     /*
29      * Class to test for boolean under(Class)
30      */

31     public void testUnderClassAndMethod() {
32         new One().test();
33         new Two().testing();
34     }
35     
36     /*
37     public void testUnderPackage() {
38         ControlFlow cflow = new ControlFlow();
39         assertFalse(cflow.underPackage("org.springframework.aop"));
40         assertTrue(cflow.underPackage("org.springframework.aop.support"));
41         assertFalse(cflow.underPackage("com.interface21"));
42     }
43     */

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