Java 类junit.framework.Protectable 实例源码

项目:gemini.blueprint    文件:AbstractOsgiTests.java   
/**
 * {@inheritDoc}
 * <p/>
 * <p/> Replacement run method. Gets a hold of the TestRunner used for running this test so it can populate it with
 * the results retrieved from OSGi.
 */
public final void run(TestResult result) {

    // get a hold of the test result
    originalResult = result;

    result.startTest(osgiJUnitTest);
    result.runProtected(osgiJUnitTest, new Protectable() {

        public void protect() throws Throwable {
            AbstractOsgiTests.this.runBare();
        }
    });
    result.endTest(osgiJUnitTest);

    // super.run(result);
}
项目:spring-osgi    文件:AbstractOsgiTests.java   
/**
 * {@inheritDoc}
 * 
 * <p/> Replacement run method. Gets a hold of the TestRunner used for
 * running this test so it can populate it with the results retrieved from
 * OSGi.
 */
public final void run(TestResult result) {

    // get a hold of the test result
    originalResult = result;

    result.startTest(osgiJUnitTest);
    result.runProtected(osgiJUnitTest, new Protectable() {

        public void protect() throws Throwable {
            AbstractOsgiTests.this.runBare();
        }
    });
    result.endTest(osgiJUnitTest);

    // super.run(result);
}
项目:reflectify    文件:SuiteOfTestCases.java   
@Override
public void run(final TestResult result) {
    Protectable p= new Protectable() {
        public void protect() throws Exception {
            try {
                // run suite (first test run will setup the suite)
                superRun(result);
            } finally { 
                // tear down the suite
                if (Suite.this.currentTestCase != null) { // protect against empty test suite
                    Suite.this.currentTestCase.tearDownSuite();
                }
            }
        }
    };
    result.runProtected(this, p);
}
项目:incubator-netbeans    文件:NbModuleSuite.java   
@Override
public void run(final TestResult result) {
    result.runProtected(this, new Protectable() {
        public @Override void protect() throws Throwable {
            ClassLoader before = Thread.currentThread().getContextClassLoader();
            try {
                runInRuntimeContainer(result);
            } finally {
                Thread.currentThread().setContextClassLoader(before);
            }
        }
    });
}
项目:gemini.blueprint    文件:OsgiJUnitService.java   
/**
 * Run fixture setup, test from the given test case and fixture teardown.
 *
 * @param osgiTestExtensions
 * @param testName
 */
protected TestResult runTest(final OsgiJUnitTest osgiTestExtensions, String testName) {
    if (log.isDebugEnabled()) {
        log.debug("Running test [" + testName + "] on testCase " + osgiTestExtensions);
    }

    final TestResult result = new TestResult();
    TestCase rawTest = osgiTestExtensions.getTestCase();
    rawTest.setName(testName);

    try {
        osgiTestExtensions.osgiSetUp();

        try {
            // use TestResult method to bypass the setUp/tearDown methods
            result.runProtected(rawTest, new Protectable() {

                public void protect() throws Throwable {
                    osgiTestExtensions.osgiRunTest();
                }

            });
        } finally {
            osgiTestExtensions.osgiTearDown();
        }
    }
    // exceptions thrown by osgiSetUp/osgiTearDown
    catch (Exception ex) {
        log.error("test exception threw exception ", ex);
        result.addError(rawTest, ex);
    }
    return result;
}
项目:cacheonix-core    文件:TestImplementorTest.java   
public void run(TestResult result) {
    result.startTest(this);
    Protectable p= new Protectable() {
        public void protect() throws Throwable {
            fTestCase.runBare();
            fTestCase.runBare();
        }
    };
    result.runProtected(this, p);
    result.endTest(this);
}
项目:In-the-Box-Fork    文件:CoreTestRunnable.java   
/**
 * Creates a new CoreTestRunnable for the given parameters.
 */
public CoreTestRunnable(TestCase test, TestResult result,
        Protectable protectable, boolean invert, boolean isolate) {

    this.fTest = test;
    this.fProtectable = protectable;
    this.fResult = result;
    this.fInvert = invert;
    this.fIsolate = isolate;
}
项目:sosiefier    文件:TestSetup.java   
@Override
public void run(final TestResult result) {
    Protectable p = new Protectable() {
        public void protect() throws Exception {
            setUp();
            basicRun(result);
            tearDown();
        }
    };
    result.runProtected(this, p);
}
项目:sosiefier    文件:TestImplementorTest.java   
public void run(TestResult result) {
    result.startTest(this);
    Protectable p = new Protectable() {
        public void protect() throws Throwable {
            fTestCase.runBare();
            fTestCase.runBare();
        }
    };
    result.runProtected(this, p);
    result.endTest(this);
}
项目:lcm    文件:TestSetup.java   
@Override
public void run(final TestResult result) {
    Protectable p = new Protectable() {
        public void protect() throws Exception {
            setUp();
            basicRun(result);
            tearDown();
        }
    };
    result.runProtected(this, p);
}
项目:spring-osgi    文件:OsgiJUnitService.java   
/**
 * Run fixture setup, test from the given test case and fixture teardown.
 * 
 * @param osgiTestExtensions
 * @param testName
 */
protected TestResult runTest(final OsgiJUnitTest osgiTestExtensions, String testName) {
    if (log.isDebugEnabled())
        log.debug("Running test [" + testName + "] on testCase " + osgiTestExtensions);
    final TestResult result = new TestResult();
    TestCase rawTest = osgiTestExtensions.getTestCase();

    rawTest.setName(testName);

    try {
        osgiTestExtensions.osgiSetUp();

        try {
            // use TestResult method to bypass the setUp/tearDown methods
            result.runProtected(rawTest, new Protectable() {

                public void protect() throws Throwable {
                    osgiTestExtensions.osgiRunTest();
                }

            });
        }
        finally {
            osgiTestExtensions.osgiTearDown();
        }

    }
    // exceptions thrown by osgiSetUp/osgiTearDown
    catch (Exception ex) {
        log.error("test exception threw exception ", ex);
        result.addError((Test) rawTest, ex);
    }
    return result;
}
项目:tomee    文件:NumberedTestCase.java   
protected void run(final TestResult result, final Method testMethod) {
    final Test test = createTest(testMethod);
    result.startTest(test);
    final Protectable p = new Protectable() {
        public void protect() throws Throwable {
            runTestMethod(testMethod);
        }
    };
    //System.out.println(">>" + NumberedTestCase.class.getName() + "> started: " + testMethod.toGenericString());
    result.runProtected(test, p);
    result.endTest(test);
    //System.out.println(">>" + NumberedTestCase.class.getName() + "> done: " + testMethod.toGenericString());
}
项目:junit    文件:TestSetup.java   
@Override
public void run(final TestResult result) {
    Protectable p = new Protectable() {
        public void protect() throws Exception {
            setUp();
            basicRun(result);
            tearDown();
        }
    };
    result.runProtected(this, p);
}
项目:junit    文件:TestImplementorTest.java   
public void run(TestResult result) {
    result.startTest(this);
    Protectable p = new Protectable() {
        public void protect() throws Throwable {
            fTestCase.runBare();
            fTestCase.runBare();
        }
    };
    result.runProtected(this, p);
    result.endTest(this);
}
项目:org.openntf.domino    文件:TestSetup.java   
@Override
public void run(final TestResult result) {
    Protectable p = new Protectable() {
        public void protect() throws Exception {
            setUp();
            basicRun(result);
            tearDown();
        }
    };
    result.runProtected(this, p);
}
项目:health-and-care-developer-network    文件:TestImplementorTest.java   
public void run(TestResult result) {
    result.startTest(this);
    Protectable p = new Protectable() {
        public void protect() throws Throwable {
            fTestCase.runBare();
            fTestCase.runBare();
        }
    };
    result.runProtected(this, p);
    result.endTest(this);
}