PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/kilim/test/TestInvalidPausables.java

http://github.com/kilim/kilim
Java | 60 lines | 46 code | 9 blank | 5 comment | 1 complexity | 554e529e9488b59d6c3ae3cf87ff20d2 MD5 | raw file
 1/* Copyright (c) 2006, Sriram Srinivasan
 2 *
 3 * You may distribute this software under the terms of the license 
 4 * specified in the file "License"
 5 */
 6
 7package kilim.test;
 8
 9import junit.framework.TestCase;
10import kilim.KilimException;
11import kilim.WeavingClassLoader;
12
13public class TestInvalidPausables extends TestCase {
14    private static boolean debug = false;
15    private void ensureException(String className) {
16        try {
17            new WeavingClassLoader().weaveClass(className);
18            fail("Expected weave exception while processing " + className);
19        } catch (KilimException ke) {
20            if (debug) System.out.println(ke);
21        } catch (Exception e) {
22            fail(e.toString());
23        }
24    }
25    public void testWeaveConstructor() {
26        ensureException("kilim.test.ex.ExInvalidConstructor");
27        ensureException("kilim.test.ex.ExInvalidConstructor2");
28        ensureException("kilim.test.ex.ExInvalidConstructor3");
29    }
30    public void testWeaveSynchronized() {
31        ensureException("kilim.test.ex.ExInvalidSynchronized");
32        ensureException("kilim.test.ex.ExInvalidSynchronized1");
33    }
34    public void testWeaveStatic() {
35        ensureException("kilim.test.ex.ExInvalidStaticBlock");
36    }
37    
38    public void testWeaveMethod() {
39        ensureException("kilim.test.ex.ExInvalidCallP_NP");
40    }
41
42    public void testWeaveSuperPausable() {
43        ensureException("kilim.test.ex.ExInvalidNPDerived");
44        
45    }
46    
47    public void testWeaveSuperNotPausable() {
48        ensureException("kilim.test.ex.ExInvalidPDerived");
49    }
50    
51    public void testWeaveInterfacePausable() {
52        ensureException("kilim.test.ex.ExInvalidPImp");
53        ensureException("kilim.test.ex.ExInvalidPFace");
54    }
55    
56    public void testWeaveInterfaceNotPausable() {
57        ensureException("kilim.test.ex.ExInvalidNPImp");
58        ensureException("kilim.test.ex.ExInvalidNPFace");
59    }
60}