Search in sources :

Example 71 with TestCase

use of junit.framework.TestCase in project junit4 by junit-team.

the class TestCaseTest method testTearDownFails.

public void testTearDownFails() {
    TestCase fails = new TestCase("success") {

        @Override
        protected void tearDown() {
            throw new Error();
        }

        @Override
        protected void runTest() {
        }
    };
    verifyError(fails);
}
Also used : TestCase(junit.framework.TestCase)

Example 72 with TestCase

use of junit.framework.TestCase in project junit4 by junit-team.

the class TestCaseTest method testErrorTearingDownDoesntMaskErrorRunning.

public void testErrorTearingDownDoesntMaskErrorRunning() {
    final Exception running = new Exception("Running");
    TestCase t = new TestCase() {

        @Override
        protected void runTest() throws Throwable {
            throw running;
        }

        @Override
        protected void tearDown() throws Exception {
            throw new Error("Tearing down");
        }
    };
    try {
        t.runBare();
    } catch (Throwable thrown) {
        assertSame(running, thrown);
    }
}
Also used : TestCase(junit.framework.TestCase)

Example 73 with TestCase

use of junit.framework.TestCase in project junit4 by junit-team.

the class TestCaseTest method testError.

public void testError() {
    TestCase error = new TestCase("error") {

        @Override
        protected void runTest() {
            throw new Error();
        }
    };
    verifyError(error);
}
Also used : TestCase(junit.framework.TestCase)

Example 74 with TestCase

use of junit.framework.TestCase in project junit4 by junit-team.

the class TestCaseTest method testFailure.

public void testFailure() {
    TestCase failure = new TestCase("failure") {

        @Override
        protected void runTest() {
            fail();
        }
    };
    verifyFailure(failure);
}
Also used : TestCase(junit.framework.TestCase)

Example 75 with TestCase

use of junit.framework.TestCase in project junit4 by junit-team.

the class TestCaseTest method testSuccess.

public void testSuccess() {
    TestCase success = new TestCase("success") {

        @Override
        protected void runTest() {
        }
    };
    verifySuccess(success);
}
Also used : TestCase(junit.framework.TestCase)

Aggregations

TestCase (junit.framework.TestCase)129 TestSuite (junit.framework.TestSuite)36 Test (junit.framework.Test)22 TestListener (junit.framework.TestListener)17 TestResult (junit.framework.TestResult)13 ArrayList (java.util.ArrayList)12 InvocationTargetException (java.lang.reflect.InvocationTargetException)10 AssertionFailedError (junit.framework.AssertionFailedError)10 Constructor (java.lang.reflect.Constructor)8 Enumeration (java.util.Enumeration)6 Context (android.content.Context)5 PackageManager (android.content.pm.PackageManager)5 ResolveInfo (android.content.pm.ResolveInfo)5 Bundle (android.os.Bundle)5 HandlerThread (android.os.HandlerThread)5 ShellUiAutomatorBridge (com.android.uiautomator.core.ShellUiAutomatorBridge)5 Tracer (com.android.uiautomator.core.Tracer)5 UiAutomationShellWrapper (com.android.uiautomator.core.UiAutomationShellWrapper)5 Field (java.lang.reflect.Field)5 HashSet (java.util.HashSet)5