Class WireMockSpringJunitExtension

java.lang.Object
org.wiremock.spring.internal.WireMockSpringJunitExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.TestInstantiationAwareExtension

public class WireMockSpringJunitExtension extends Object implements org.junit.jupiter.api.extension.ParameterResolver
JUnit 5 extension that resolves InjectWireMock-annotated constructor and method parameters to the WireMockServer instances registered with ConfigureWireMock.

Injecting @InjectWireMock fields, resetting servers between tests and configuring the default WireMock client happen in WireMockTestExecutionListener instead, so that they also work with test engines other than JUnit Jupiter (e.g. Cucumber, TestNG) that drive Spring's TestContextManager directly. Parameter resolution has no equivalent in the Spring TestContext framework, so it remains here.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension

    org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension

    getTestInstantiationExtensionContextScope
  • Constructor Details

    • WireMockSpringJunitExtension

      public WireMockSpringJunitExtension()
  • Method Details

    • supportsParameter

      public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Specified by:
      supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolver
    • resolveParameter

      public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Specified by:
      resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolver