Class WireMockMultiServerRule

java.lang.Object
org.kohsuke.github.junit.WireMockMultiServerRule
All Implemented Interfaces:
org.junit.rules.MethodRule, org.junit.rules.TestRule
Direct Known Subclasses:
GitHubWireMockRule

public class WireMockMultiServerRule extends Object implements org.junit.rules.MethodRule, org.junit.rules.TestRule
The standard WireMockRule eagerly initializes a WireMockServer. This version supports multiple servers in one rule and takes a lazy approach to intitialization allowing us to isolate files snapshots for each method.
Author:
Liam Newman
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Map<String,com.github.tomakehurst.wiremock.WireMockServer>
    The servers.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new wire mock multi server rule.
    WireMockMultiServerRule(com.github.tomakehurst.wiremock.core.Options options)
    Instantiates a new wire mock multi server rule.
    WireMockMultiServerRule(com.github.tomakehurst.wiremock.core.Options options, boolean failOnUnmatchedRequests)
    Instantiates a new wire mock multi server rule.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    After.
    org.junit.runners.model.Statement
    apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
    Apply.
    org.junit.runners.model.Statement
    apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)
    Apply.
    protected void
    Before.
    Gets the method name.
    protected final void
    initializeServer(String serverId, com.github.tomakehurst.wiremock.extension.Extension... extensions)
    Initialize server.
    protected void
    Initialize servers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • servers

      protected final Map<String,com.github.tomakehurst.wiremock.WireMockServer> servers
      The servers.
  • Constructor Details

    • WireMockMultiServerRule

      public WireMockMultiServerRule(com.github.tomakehurst.wiremock.core.Options options)
      Instantiates a new wire mock multi server rule.
      Parameters:
      options - the options
    • WireMockMultiServerRule

      public WireMockMultiServerRule(com.github.tomakehurst.wiremock.core.Options options, boolean failOnUnmatchedRequests)
      Instantiates a new wire mock multi server rule.
      Parameters:
      options - the options
      failOnUnmatchedRequests - the fail on unmatched requests
    • WireMockMultiServerRule

      public WireMockMultiServerRule()
      Instantiates a new wire mock multi server rule.
  • Method Details

    • getMethodName

      public String getMethodName()
      Gets the method name.
      Returns:
      the method name
    • apply

      public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
      Apply.
      Specified by:
      apply in interface org.junit.rules.TestRule
      Parameters:
      base - the base
      description - the description
      Returns:
      the statement
    • apply

      public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)
      Apply.
      Specified by:
      apply in interface org.junit.rules.MethodRule
      Parameters:
      base - the base
      method - the method
      target - the target
      Returns:
      the statement
    • initializeServers

      protected void initializeServers()
      Initialize servers.
    • initializeServer

      protected final void initializeServer(String serverId, com.github.tomakehurst.wiremock.extension.Extension... extensions)
      Initialize server.
      Parameters:
      serverId - the server id
      extensions - the extensions
    • before

      protected void before()
      Before.
    • after

      protected void after()
      After.