use of junit.extensions.TestSetup in project hadoop by apache.
the class TestDataJoin method suite.
public static Test suite() {
TestSetup setup = new TestSetup(new TestSuite(TestDataJoin.class)) {
protected void setUp() throws Exception {
Configuration conf = new Configuration();
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
}
protected void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
};
return setup;
}
use of junit.extensions.TestSetup in project junit4 by junit-team.
the class ExtensionTest method testRunningErrorsInTestSetup.
public void testRunningErrorsInTestSetup() {
TestCase failure = new TestCase("failure") {
@Override
public void runTest() {
fail();
}
};
TestCase error = new TestCase("error") {
@Override
public void runTest() {
throw new Error();
}
};
TestSuite suite = new TestSuite();
suite.addTest(failure);
suite.addTest(error);
TestSetup wrapper = new TestSetup(suite);
TestResult result = new TestResult();
wrapper.run(result);
assertEquals(1, result.failureCount());
assertEquals(1, result.errorCount());
}
use of junit.extensions.TestSetup in project jmeter by apache.
the class TestHTTPMirrorThread method suite.
// We need to use a suite in order to preserve the server across test cases
// With JUnit4 we could use before/after class annotations
public static Test suite() {
TestSetup setup = new TestSetup(new TestSuite(TestHTTPMirrorThread.class)) {
private HttpMirrorServer httpServer;
@Override
protected void setUp() throws Exception {
httpServer = startHttpMirror(HTTP_SERVER_PORT);
}
@Override
protected void tearDown() throws Exception {
// Shutdown the http server
httpServer.stopServer();
httpServer = null;
}
};
return setup;
}
use of junit.extensions.TestSetup in project gradle by gradle.
the class SomeSuite method suite.
public static Test suite() {
final TestSuite suite = new TestSuite();
suite.addTestSuite(SomeTest1.class);
suite.addTestSuite(SomeTest2.class);
TestSetup wrappedSuite = new junit.extensions.TestSetup(suite) {
protected void setUp() {
System.out.println("stdout in TestSetup#setup");
System.err.println("stderr in TestSetup#setup");
}
protected void tearDown() {
System.out.println("stdout in TestSetup#teardown");
System.err.println("stderr in TestSetup#teardown");
}
};
return wrappedSuite;
}
use of junit.extensions.TestSetup in project junit4 by junit-team.
the class ExtensionTest method testSetupErrorInTestSetup.
public void testSetupErrorInTestSetup() {
WasRun test = new WasRun();
TestSetup wrapper = new TestSetup(test) {
@SuppressWarnings("deprecation")
@Override
public void setUp() {
fail();
}
};
TestResult result = new TestResult();
wrapper.run(result);
assertTrue(!test.fWasRun);
assertTrue(!result.wasSuccessful());
}
Aggregations