org.junit.platform.engine.EngineExecutionListener Java Examples
The following examples show how to use
org.junit.platform.engine.EngineExecutionListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestClassExecutor.java From webtester2-core with Apache License 2.0 | 6 votes |
public static void execute(Class<?> testClass) throws Exception { try { JupiterTestEngine engine = new JupiterTestEngine(); TestClassEngineDiscoveryRequest discoveryRequest = new TestClassEngineDiscoveryRequest(testClass); TestDescriptor testDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine("foo-bar")); EngineExecutionListener listener = new NoOpEngineExecutionListener(); ConfigurationParameters parameters = new NoConfigurationParameters(); engine.execute(new ExecutionRequest(testDescriptor, listener, parameters)); } catch (UndeclaredThrowableException e) { Throwable cause = getFirstNonUndeclaredThrowableCause(e); if (cause instanceof Error) { throw ( Error ) cause; } else if (cause instanceof RuntimeException) { throw ( RuntimeException ) cause; } else if (cause instanceof Exception) { throw ( Exception ) cause; } else { throw e; } } }