Class DmnEngineExtension
java.lang.Object
org.camunda.bpm.dmn.engine.test.junit5.DmnEngineExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeTestExecutionCallback
,org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.ParameterResolver
,org.junit.jupiter.api.extension.TestInstancePostProcessor
public class DmnEngineExtension
extends Object
implements org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.BeforeTestExecutionCallback, org.junit.jupiter.api.extension.ParameterResolver
JUnit 5 Extension to create and inject a
DmnEngine
into the test class.
Usage with the default configuration:
@ExtendWith(DmnEngineExtension.class)
public class YourTest { // Provide a property where the extension can inject the DMN engine... public DmnEngine dmnEngine; // ... or a test method parameter, whichever better suits your needs.@Test
void testDecision(DmnEngine dmnEngine) { } ... }
If you want to use a custom DmnEngineConfiguration
(created in the test programmatically),
you can register the extension directly and use the factory method to configure it.
Usage with a custom configuration:
DmnEngineConfiguration myConfiguration = createMyEngineConfiguration();
@RegisterExtension
DmnEngineExtension dmnEngineExtension = DmnEngineExtension.forConfiguration(myConfiguration);
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeTestExecution
(org.junit.jupiter.api.extension.ExtensionContext context) static DmnEngineExtension
forConfiguration
(DmnEngineConfiguration configuration) protected void
protected void
injectDmnEngine
(Object instance, Field field) void
postProcessTestInstance
(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) boolean
supportsParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
-
Field Details
-
dmnEngineConfiguration
-
dmnEngine
-
-
Constructor Details
-
DmnEngineExtension
public DmnEngineExtension() -
DmnEngineExtension
-
-
Method Details
-
forConfiguration
-
initializeDmnEngine
protected void initializeDmnEngine() -
injectDmnEngine
-
postProcessTestInstance
public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) throws Exception - Specified by:
postProcessTestInstance
in interfaceorg.junit.jupiter.api.extension.TestInstancePostProcessor
- Throws:
Exception
-
beforeTestExecution
public void beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception - Specified by:
beforeTestExecution
in interfaceorg.junit.jupiter.api.extension.BeforeTestExecutionCallback
- Throws:
Exception
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException - Specified by:
supportsParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException - Specified by:
resolveParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-