java.lang.Object
org.kohsuke.github.AbstractGitHubWireMockTest
- Direct Known Subclasses:
AbstractGHAppInstallationTest
,AbuseLimitHandlerTest
,AppTest
,AuthorizationTokenRefreshTest
,CommitTest
,DefaultGitHubConnectorTest
,EnterpriseManagedSupportTest
,EnumTest
,GHAppExtendedTest
,GHBranchProtectionTest
,GHBranchTest
,GHCodeownersErrorTest
,GHContentIntegrationTest
,GHDeployKeyTest
,GHDeploymentTest
,GHDiscussionTest
,GHEventPayloadTest
,GHExternalGroupTest
,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
,GitHubConnectionTest
,GitHubStaticTest
,GitHubTest
,LifecycleTest
,OkHttpGitHubConnectorTest
,RateLimitCheckerTest
,RateLimitHandlerTest
,RepositoryTrafficTest
,RequesterRetryTest
,WireMockStatusReporterTest
The Class AbstractGitHubWireMockTest.
- Author:
- Liam Newman
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
The Class TemplatingHelper. -
Field Summary
Modifier and TypeFieldDescriptionprotected final String
The base files class path.protected final String
The base record path.protected GitHub
GitHub
instance for use during test.final GitHubWireMockRule
The mock git hub.The temp git hub repositories.protected final AbstractGitHubWireMockTest.TemplatingHelper
The templating.protected boolean
The use default git hub. -
Constructor Summary
ConstructorDescriptionInstantiates a new abstract git hub wire mock test. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertThat
(String reason, boolean assertion) Assert that.static <T> void
assertThat
(String reason, T actual, org.hamcrest.Matcher<? super T> matcher) Assert that.static <T> void
assertThat
(T actual, org.hamcrest.Matcher<? super T> matcher) Assert that.protected void
cleanupRepository
(String fullName) Cleanup repository.void
Cleanup temp repositories.static void
fail()
Fail.static void
Fail.protected GitHubBuilder
Gets the git hub builder.GitHub
instance for use before/after test.protected GHRepository
Creates a temporary repository that will be deleted at the end of the test.protected GHRepository
getTempRepository
(String name) Creates a temporary repository that will be deleted at the end of the test.protected GHUser
getUser()
Gets the user.protected static GHUser
Gets the user.protected com.github.tomakehurst.wiremock.core.WireMockConfiguration
Gets the wire mock options.protected void
kohsuke()
Kohsuke.protected void
requireProxy
(String reason) Require proxy.protected void
Snapshot not allowed.protected void
verifyAuthenticated
(GitHub instance) Verify authenticated.void
Wire mock setup.
-
Field Details
-
useDefaultGitHub
protected boolean useDefaultGitHubThe use default git hub. -
tempGitHubRepositories
The temp git hub repositories. -
gitHub
GitHub
instance for use during test. Traffic will be part of snapshot when taken. -
baseFilesClassPath
The base files class path. -
baseRecordPath
The base record path. -
mockGitHub
The mock git hub. -
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
Gets the git hub builder.- Returns:
- the git hub builder
-
wireMockSetup
Wire mock setup.- Throws:
Exception
- the exception
-
snapshotNotAllowed
protected void snapshotNotAllowed()Snapshot not allowed. -
requireProxy
Require proxy.- Parameters:
reason
- the reason
-
verifyAuthenticated
Verify authenticated.- Parameters:
instance
- the instance
-
getUser
Gets the user.- Returns:
- the user
-
getUser
Gets the user.- Parameters:
gitHub
- the git hub- Returns:
- the user
-
getTempRepository
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
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
Cleanup temp repositories.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
cleanupRepository
Cleanup repository.- Parameters:
fullName
- the full name- Throws:
IOException
- Signals that an I/O exception has occurred.
-
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
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 actualmatcher
- the matcher
-
assertThat
Assert that.- Type Parameters:
T
- the generic type- Parameters:
reason
- the reasonactual
- the actualmatcher
- the matcher
-
assertThat
Assert that.- Parameters:
reason
- the reasonassertion
- the assertion
-