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 Details

  • Constructor Details

    • DmnEngineExtension

      public DmnEngineExtension()
    • DmnEngineExtension

      protected DmnEngineExtension(DmnEngineConfiguration configuration)
  • Method Details

    • forConfiguration

      public static DmnEngineExtension forConfiguration(DmnEngineConfiguration configuration)
    • initializeDmnEngine

      protected void initializeDmnEngine()
    • injectDmnEngine

      protected void injectDmnEngine(Object instance, Field field)
    • postProcessTestInstance

      public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      postProcessTestInstance in interface org.junit.jupiter.api.extension.TestInstancePostProcessor
      Throws:
      Exception
    • beforeTestExecution

      public void beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      beforeTestExecution in interface org.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 interface org.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 interface org.junit.jupiter.api.extension.ParameterResolver
      Throws:
      org.junit.jupiter.api.extension.ParameterResolutionException