use of org.junit.runner.JUnitCore in project randomizedtesting by randomizedtesting.
the class TestAnnotationInheritance method assertSameExecution.
private void assertSameExecution(Class<?> clazz) throws Exception {
order.clear();
runTests(clazz);
List<String> order1 = new ArrayList<>(order);
order.clear();
new JUnitCore().run(Request.runner(new RandomizedRunner(clazz)));
List<String> order2 = new ArrayList<>(order);
order.clear();
String msg = "# JUnit order:\n" + order1 + "\n" + "# RR order:\n" + order2;
Assertions.assertThat(order2).as(msg).isEqualTo(order1);
}
use of org.junit.runner.JUnitCore in project randomizedtesting by randomizedtesting.
the class TestClassRules method assertSameExecution.
private void assertSameExecution(Class<?> clazz) throws Exception {
order.clear();
runTests(clazz);
List<String> order1 = new ArrayList<>(order);
order.clear();
new JUnitCore().run(Request.runner(new RandomizedRunner(clazz)));
List<String> order2 = new ArrayList<>(order);
order.clear();
Assert.assertEquals(order1, order2);
}
use of org.junit.runner.JUnitCore in project randomizedtesting by randomizedtesting.
the class PrivateHooksPropagation method assertSameExecution.
private void assertSameExecution(Class<?> clazz) throws Exception {
new JUnitCore().run(Request.runner(new RandomizedRunner(clazz)));
List<String> order1 = new ArrayList<>(order);
order.clear();
String msg = "# RR order:\n" + order1;
Assertions.assertThat(order1).as(msg).containsOnly("super.beforeclass1", "sub.beforeclass1", "sub.beforeclass2", "super.before1", "sub.before1", "sub.before2", "super.testMethod1");
}
use of org.junit.runner.JUnitCore in project randomizedtesting by randomizedtesting.
the class TestCustomMethodProvider method testJUnit4Valid.
@Test
public void testJUnit4Valid() throws InitializationError {
Class<?>[] valid = { T1.class, RT1.class };
for (Class<?> cl : valid) {
Result r = new JUnitCore().run(new RandomizedRunner(cl));
Assert.assertEquals(0, r.getFailureCount());
Assert.assertEquals(1, r.getRunCount());
}
}
use of org.junit.runner.JUnitCore in project randomizedtesting by randomizedtesting.
the class TestJUnit3MethodProvider method testJUnit3Invalid.
@Test
public void testJUnit3Invalid() {
Class<?>[] invalid = { T2.class, T3.class, T4.class, ST1.class, ST2.class, ST3.class, ST4.class, AT1.class };
for (Class<?> cl : invalid) {
try {
new JUnitCore().run(new RandomizedRunner(cl));
Assert.fail("Expected to fail for: " + cl);
} catch (InitializationError e) {
// expected.
}
}
}
Aggregations