Class GitHubWireMockRule

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

public class GitHubWireMockRule extends WireMockMultiServerRule
The standard WireMockRule eagerly initializes a WireMockServer. This version suptakes a laze approach allowing us to automatically isolate snapshots for each method.
Author:
Liam Newman
  • Constructor Details

    • GitHubWireMockRule

      public GitHubWireMockRule()
      Instantiates a new git hub wire mock rule.
    • GitHubWireMockRule

      public GitHubWireMockRule(com.github.tomakehurst.wiremock.core.WireMockConfiguration options)
      Instantiates a new git hub wire mock rule.
      Parameters:
      options - the options
    • GitHubWireMockRule

      public GitHubWireMockRule(com.github.tomakehurst.wiremock.core.WireMockConfiguration options, boolean failOnUnmatchedRequests)
      Instantiates a new git hub wire mock rule.
      Parameters:
      options - the options
      failOnUnmatchedRequests - the fail on unmatched requests
  • Method Details

    • customizeRecordSpec

      public void customizeRecordSpec(Consumer<com.github.tomakehurst.wiremock.recording.RecordSpecBuilder> customizeRecordSpec)
      Customize record spec.
      Parameters:
      customizeRecordSpec - the customize record spec
    • apiServer

      public com.github.tomakehurst.wiremock.WireMockServer apiServer()
      Api server.
      Returns:
      the wire mock server
    • rawServer

      public com.github.tomakehurst.wiremock.WireMockServer rawServer()
      Raw server.
      Returns:
      the wire mock server
    • uploadsServer

      public com.github.tomakehurst.wiremock.WireMockServer uploadsServer()
      Uploads server.
      Returns:
      the wire mock server
    • codeloadServer

      public com.github.tomakehurst.wiremock.WireMockServer codeloadServer()
      Codeload server.
      Returns:
      the wire mock server
    • actionsUserContentServer

      public com.github.tomakehurst.wiremock.WireMockServer actionsUserContentServer()
      Actions user content server.
      Returns:
      the wire mock server
    • blobCoreWindowsNetServer

      public com.github.tomakehurst.wiremock.WireMockServer blobCoreWindowsNetServer()
      Actions user content server.
      Returns:
      the wire mock server
    • isUseProxy

      public boolean isUseProxy()
      Checks if is use proxy.
      Returns:
      true, if is use proxy
    • isTakeSnapshot

      public boolean isTakeSnapshot()
      Checks if is take snapshot.
      Returns:
      true, if is take snapshot
    • isTestWithOrg

      public boolean isTestWithOrg()
      Checks if is test with org.
      Returns:
      true, if is test with org
    • initializeServers

      protected void initializeServers()
      Initialize servers.
      Overrides:
      initializeServers in class WireMockMultiServerRule
    • before

      protected void before()
      Before.
      Overrides:
      before in class WireMockMultiServerRule
    • after

      protected void after()
      After.
      Overrides:
      after in class WireMockMultiServerRule
    • getRequestCount

      public int getRequestCount()
      Gets the request count.
      Returns:
      the request count
    • getRequestCount

      public static int getRequestCount(com.github.tomakehurst.wiremock.WireMockServer server)
      Gets the request count.
      Parameters:
      server - the server
      Returns:
      the request count
    • mapToMockGitHub

      @Nonnull public String mapToMockGitHub(String body)
      Map to mock git hub.
      Parameters:
      body - the body
      Returns:
      the string