FileDocCategorySizeDatePackage
ClassHasNativeVisitorTest.javaAPI DocAndroid 5.1 API3067Thu Mar 12 22:22:44 GMT 2015com.android.tools.layoutlib.create

ClassHasNativeVisitorTest

public class ClassHasNativeVisitorTest extends Object
Tests {@link ClassHasNativeVisitor}.

Fields Summary
Constructors Summary
Methods Summary
public voidtestHasNative()

        MockClassHasNativeVisitor cv = new MockClassHasNativeVisitor();
        String className =
                this.getClass().getCanonicalName() + "$" + ClassWithNative.class.getSimpleName();
        ClassReader cr = new ClassReader(className);

        cr.accept(cv, 0 /* flags */);
        assertArrayEquals(new String[] { "native_method" }, cv.getMethodsFound());
        assertTrue(cv.hasNativeMethods());
    
public voidtestHasNoNative()

        MockClassHasNativeVisitor cv = new MockClassHasNativeVisitor();
        String className =
            this.getClass().getCanonicalName() + "$" + ClassWithoutNative.class.getSimpleName();
        ClassReader cr = new ClassReader(className);

        cr.accept(cv, 0 /* flags */);
        assertArrayEquals(new String[0], cv.getMethodsFound());
        assertFalse(cv.hasNativeMethods());