1 30 package org.objectweb.asm; 31 32 import junit.framework.TestSuite; 33 34 39 public class ClassAdapterTest extends AbstractTest { 40 41 private final static TestClassLoader LOADER = new TestClassLoader(); 42 43 public static TestSuite suite() throws Exception { 44 return new ClassAdapterTest().getSuite(); 45 } 46 47 public void test() throws Exception { 48 ClassReader cr = new ClassReader(is); 49 ClassWriter cw = new ClassWriter(true, true); 50 cr.accept(new ClassAdapter(cw), false); 51 byte[] b = cw.toByteArray(); 52 try { 53 LOADER.defineClass(n, b); 54 } catch (ClassFormatError cfe) { 55 fail(cfe.getMessage()); 56 } catch (Throwable ignored) { 57 } 58 } 59 60 62 static class TestClassLoader extends ClassLoader { 63 64 public Class defineClass(final String name, final byte[] b) { 65 return defineClass(name, b, 0, b.length); 66 } 67 } 68 } 69 | Popular Tags |