FileDocCategorySizeDatePackage
MethodSourcerTest.javaAPI DocAndroid 1.5 API2654Wed May 06 22:41:10 BST 2009com.android.mkstubs.sourcer

MethodSourcerTest

public class MethodSourcerTest extends TestHelper

Fields Summary
private StringWriter
mWriter
private Output
mOutput
Constructors Summary
Methods Summary
public voidsetUp()

        mWriter = new StringWriter();
        mOutput = new Output(mWriter);
    
public voidtearDown()

        mWriter = null;
    
public voidtestReturnMap()

        MethodSourcer m = new MethodSourcer(mOutput,
                "foo", //classname
                Opcodes.ACC_PUBLIC, //access
                "getMap_T_U", //name
                "()Ljava/util/Map;", //desc
                "()Ljava/util/Map<TT;TU;>;", //signature
                null); //exception
        m.visitEnd();
        
        assertSourceEquals(
                "public java.util.Map<T, U> getMap_T_U() { }",
                mWriter.toString());
    
public voidtestVoid()

        MethodSourcer m = new MethodSourcer(mOutput,
                "foo", //classname
                Opcodes.ACC_PUBLIC, //access
                "testVoid", //name
                "()V", //desc
                null, //signature
                null); //exception
        m.visitEnd();
        
        assertSourceEquals(
                "public void testVoid() { }",
                mWriter.toString());
    
public voidtestVoidThrow()

        MethodSourcer m = new MethodSourcer(mOutput,
                "foo", //classname
                Opcodes.ACC_PUBLIC, //access
                "testVoid", //name
                "()V", //desc
                null, //signature
                new String[] { "java/lang/Exception" }); //exception
        m.visitEnd();
        
        assertSourceEquals(
                "public void testVoid() throws java.lang.Exception { }",
                mWriter.toString());