KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > Test3


1 /**
2  * JavaGuard -- an obfuscation package for Java classfiles.
3  *
4  * Copyright (c) 2002 Thorsten Heit (theit@gmx.de)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * The author may be contacted at theit@gmx.de.
21  *
22  *
23  * $Id: Test3.java,v 1.1 2002/05/28 14:12:06 glurk Exp $
24  */

25 package test;
26
27
28 /** This is a simple test class to demonstrate that the obfuscator works.
29  *
30  * @author <a HREF="mailto:theit@gmx.de">Thorsten Heit</a>
31  */

32 public class Test3 extends Test1 {
33   /** Prints a simple test message to the system console.
34    */

35   public void printMessage() {
36     System.out.println("Test message from Test3: " + getText());
37   }
38   
39   
40   /** A simple test function to verify that derived interfaces are processed
41    * correctly by the obfuscator.
42    */

43   public void testInterfaces() {
44     InterfaceTest interfaceTest = new InterfaceTest();
45     TopLevelInterface tli = interfaceTest.getTopLevelInterfaceImpl();
46     FirstLevelInterface fli = interfaceTest.getFirstLevelInterfaceImpl();
47     SecondLevelInterface sli = interfaceTest.getSecondLevelInterfaceImpl();
48     System.out.println("Top level interface test");
49     System.out.println(tli.topLevelMessage());
50     System.out.println();
51     System.out.println("First level interface test");
52     System.out.println(fli.topLevelMessage());
53     System.out.println(fli.firstLevelMessage());
54     System.out.println();
55     System.out.println("Second level interface test");
56     System.out.println(sli.topLevelMessage());
57     System.out.println(sli.firstLevelMessage());
58     System.out.println(sli.secondLevelMessage());
59   }
60   
61   
62   
63   
64   /** Main method that starts the test.
65    * @param args the command line arguments (not used)
66    */

67   public static void main(String JavaDoc[] args) {
68     Test3 t = new Test3();
69     t.printMessage();
70     t.testInterfaces();
71   }
72 }
73
Popular Tags