KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonicsystems > jarjar > GenericsTest


1 /*
2   Jar Jar Links - A utility to repackage and embed Java libraries
3   Copyright (C) 2004 Tonic Systems, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program; see the file COPYING. if not, write to
17   the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18   Boston, MA 02111-1307 USA
19 */

20
21 package com.tonicsystems.jarjar;
22
23 import com.tonicsystems.jarjar.util.*;
24 import junit.framework.*;
25 import java.util.*;
26 import org.objectweb.asm.ClassReader;
27 import org.objectweb.asm.commons.EmptyVisitor;
28
29 public class GenericsTest
30 extends TestCase
31 {
32     public void testTransform() throws Exception JavaDoc {
33          Rule rule = new Rule();
34          rule.setPattern("java.lang.String");
35          rule.setResult("com.tonicsystems.String");
36          Rules rules = new RulesImpl(Arrays.asList(new Object JavaDoc[]{ rule }), false);
37          PackageTransformer t = new PackageTransformer(rules);
38          t.setTarget(new EmptyVisitor());
39          ClassReader reader = new ClassReader(getClass().getResourceAsStream("/Generics.class"));
40          reader.accept(t, false);
41     }
42
43     public GenericsTest(String JavaDoc name) {
44         super(name);
45     }
46
47     public static Test suite() {
48         return new TestSuite(GenericsTest.class);
49     }
50 }
51
Popular Tags