use of org.junit.runner.notification.RunListener in project verify-hub by alphagov.
the class InfinispanJunitRunner method run.
@Override
public void run(final RunNotifier notifier) {
notifier.addListener(new RunListener() {
@Override
public void testStarted(Description description) throws Exception {
super.testStarted(description);
}
@Override
public void testFinished(Description description) throws Exception {
super.testFinished(description);
EMBEDDED_CACHE_MANAGER.getCache("state_cache").clear();
EMBEDDED_CACHE_MANAGER.getCache("assertion_id_cache").clear();
}
});
super.run(notifier);
}
use of org.junit.runner.notification.RunListener in project drools by kiegroup.
the class ScenarioRunner4JUnitTest method testBasic.
@Test
public void testBasic() throws Exception {
HashMap<String, KieSession> ksessions = new HashMap<String, KieSession>();
ksessions.put("someId", ksession);
Scenario scenario = new Scenario();
scenario.getKSessions().add("someId");
ScenarioRunner4JUnit runner4JUnit = new ScenarioRunner4JUnit(scenario, ksessions);
RunNotifier notifier = new RunNotifier();
RunListener runListener = spy(new RunListener());
notifier.addListener(runListener);
runner4JUnit.run(notifier);
verify(runListener, never()).testFailure(any(Failure.class));
verify(runListener).testFinished(any(Description.class));
verify(ksession).reset();
}
use of org.junit.runner.notification.RunListener in project drools by kiegroup.
the class ScenarioRunner4JUnitTest method testIDNotSet.
@Test
public void testIDNotSet() throws Exception {
HashMap<String, KieSession> ksessions = new HashMap<String, KieSession>();
ksessions.put(null, ksession);
ScenarioRunner4JUnit runner4JUnit = new ScenarioRunner4JUnit(new Scenario(), ksessions);
RunNotifier notifier = new RunNotifier();
RunListener runListener = spy(new RunListener());
notifier.addListener(runListener);
runner4JUnit.run(notifier);
verify(runListener, never()).testFailure(any(Failure.class));
verify(runListener).testFinished(any(Description.class));
verify(ksession).reset();
}
use of org.junit.runner.notification.RunListener in project drools by kiegroup.
the class ScenarioRunner4JUnitTest method testNoKieSession.
@Test
public void testNoKieSession() throws Exception {
ScenarioRunner4JUnit runner4JUnit = new ScenarioRunner4JUnit(new Scenario(), new HashMap<String, KieSession>());
RunNotifier notifier = new RunNotifier();
RunListener runListener = spy(new RunListener());
notifier.addListener(runListener);
runner4JUnit.run(notifier);
verify(runListener).testFailure(any(Failure.class));
}
use of org.junit.runner.notification.RunListener in project devonfw-testing by devonfw.
the class TestWatcherExceptionTest method initJUnit.
@BeforeClass
public static void initJUnit() {
BFLogger.logInfo("Starting base test");
computer = new Computer();
jUnitCore = new JUnitCore();
jUnitCore.addListener(new RunListener() {
@Override
public void testFailure(Failure failure) throws Exception {
thrownException = failure.getException();
BFLogger.logInfo("An exception has been thrown: " + thrownException.getMessage());
}
});
}
Aggregations