FileDocCategorySizeDatePackage
AssignableFromTest.javaAPI DocAndroid 1.5 API2497Wed May 06 22:42:02 BST 2009android.test.suitebuilder

AssignableFromTest

public class AssignableFromTest extends junit.framework.TestCase

Fields Summary
private AssignableFrom
assignableFrom
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        assignableFrom = new AssignableFrom(Animal.class);
    
public voidtestImplementorsAreAssignable()

        assignableFrom = new AssignableFrom(WritingInstrument.class);

        assertTrue(assignableFrom.apply(testMethodFor(Pencil.class)));
        assertTrue(assignableFrom.apply(testMethodFor(Pen.class)));
    
private TestMethodtestMethodFor(java.lang.Class aClass)

        Method method = aClass.getMethod("testX");
        return new TestMethod(method, aClass);
    
public voidtestNotAssignable()

        assertFalse(assignableFrom.apply(testMethodFor(Pencil.class)));
    
public voidtestSelfIsAssignable()

        assertTrue(assignableFrom.apply(testMethodFor(Animal.class)));
    
public voidtestSubclassesAreAssignable()

        assertTrue(assignableFrom.apply(testMethodFor(Mammal.class)));
        assertTrue(assignableFrom.apply(testMethodFor(Human.class)));