Class AbstractGitHubWireMockTest

java.lang.Object
org.kohsuke.github.AbstractGitHubWireMockTest
Direct Known Subclasses:
AbstractGHAppInstallationTest, AbuseLimitHandlerTest, AppTest, AuthorizationTokenRefreshTest, CommitTest, DefaultGitHubConnectorTest, EnumTest, GHAppExtendedTest, GHBranchProtectionTest, GHBranchTest, GHCodeownersErrorTest, GHContentIntegrationTest, GHDeployKeyTest, GHDeploymentTest, GHDiscussionTest, GHEventPayloadTest, GHGistTest, GHGistUpdaterTest, GHIssueEventAttributeTest, GHIssueEventTest, GHIssueTest, GHLicenseTest, GHMarketplacePlanTest, GHMilestoneTest, GHObjectTest, GHOrganizationTest, GHPersonTest, GHProjectCardTest, GHProjectColumnTest, GHProjectTest, GHPublicKeyTest, GHPullRequestTest, GHRateLimitTest, GHReleaseTest, GHRepositoryStatisticsTest, GHRepositoryTest, GHTagTest, GHTeamBuilderTest, GHTeamTest, GHTreeBuilderTest, GHUserTest, GHVerificationReasonTest, GHWorkflowRunTest, GHWorkflowTest, Github2faTest, GitHubCachingTest, GitHubCachingTest, GitHubConnectionTest, GitHubStaticTest, GitHubTest, LifecycleTest, OkHttpConnectorTest, OkHttpConnectorTest, OkHttpGitHubConnectorTest, RateLimitCheckerTest, RateLimitHandlerTest, RepositoryTrafficTest, RequesterRetryTest, WireMockStatusReporterTest

public abstract class AbstractGitHubWireMockTest extends Object
The Class AbstractGitHubWireMockTest.
Author:
Liam Newman
  • Field Details

    • useDefaultGitHub

      protected boolean useDefaultGitHub
      The use default git hub.
    • tempGitHubRepositories

      protected final Set<String> tempGitHubRepositories
      The temp git hub repositories.
    • gitHub

      protected GitHub gitHub
      GitHub instance for use during test. Traffic will be part of snapshot when taken.
    • baseFilesClassPath

      protected final String baseFilesClassPath
      The base files class path.
    • baseRecordPath

      protected final String baseRecordPath
      The base record path.
    • mockGitHub

      public final GitHubWireMockRule mockGitHub
      The mock git hub.
    • templating

      protected final AbstractGitHubWireMockTest.TemplatingHelper templating
      The templating.
  • Constructor Details

    • AbstractGitHubWireMockTest

      public AbstractGitHubWireMockTest()
      Instantiates a new abstract git hub wire mock test.
  • Method Details

    • getWireMockOptions

      protected com.github.tomakehurst.wiremock.core.WireMockConfiguration getWireMockOptions()
      Gets the wire mock options.
      Returns:
      the wire mock options
    • getGitHubBuilder

      protected GitHubBuilder getGitHubBuilder()
      Gets the git hub builder.
      Returns:
      the git hub builder
    • wireMockSetup

      public void wireMockSetup() throws Exception
      Wire mock setup.
      Throws:
      Exception - the exception
    • snapshotNotAllowed

      protected void snapshotNotAllowed()
      Snapshot not allowed.
    • requireProxy

      protected void requireProxy(String reason)
      Require proxy.
      Parameters:
      reason - the reason
    • verifyAuthenticated

      protected void verifyAuthenticated(GitHub instance)
      Verify authenticated.
      Parameters:
      instance - the instance
    • getUser

      protected GHUser getUser()
      Gets the user.
      Returns:
      the user
    • getUser

      protected static GHUser getUser(GitHub gitHub)
      Gets the user.
      Parameters:
      gitHub - the git hub
      Returns:
      the user
    • getTempRepository

      protected GHRepository getTempRepository() throws IOException
      Creates a temporary repository that will be deleted at the end of the test. Repository name is based on the current test method.
      Returns:
      a temporary repository
      Throws:
      IOException - if repository could not be created or retrieved.
    • getTempRepository

      protected GHRepository getTempRepository(String name) throws IOException
      Creates a temporary repository that will be deleted at the end of the test.
      Parameters:
      name - string name of the repository
      Returns:
      a temporary repository
      Throws:
      IOException - if repository could not be created or retrieved.
    • cleanupTempRepositories

      public void cleanupTempRepositories() throws IOException
      Cleanup temp repositories.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • cleanupRepository

      protected void cleanupRepository(String fullName) throws IOException
      Cleanup repository.
      Parameters:
      fullName - the full name
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getNonRecordingGitHub

      public GitHub getNonRecordingGitHub()
      GitHub instance for use before/after test. Traffic will not be part of snapshot when taken. Should only be used when isUseProxy() or isTakeSnapShot().
      Returns:
      a github instance after checking Authentication
    • kohsuke

      protected void kohsuke()
      Kohsuke.
    • fail

      public static void fail()
      Fail.
    • fail

      public static void fail(String reason)
      Fail.
      Parameters:
      reason - the reason
    • assertThat

      public static <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher)
      Assert that.
      Type Parameters:
      T - the generic type
      Parameters:
      actual - the actual
      matcher - the matcher
    • assertThat

      public static <T> void assertThat(String reason, T actual, org.hamcrest.Matcher<? super T> matcher)
      Assert that.
      Type Parameters:
      T - the generic type
      Parameters:
      reason - the reason
      actual - the actual
      matcher - the matcher
    • assertThat

      public static void assertThat(String reason, boolean assertion)
      Assert that.
      Parameters:
      reason - the reason
      assertion - the assertion