Package org.kohsuke.github
Class AbstractGitHubWireMockTest
- java.lang.Object
-
- org.kohsuke.github.AbstractGitHubWireMockTest
-
- Direct Known Subclasses:
AbstractGHAppInstallationTest,AbuseLimitHandlerTest,AppTest,CommitTest,EnumTest,GHAppTest,GHBranchProtectionTest,GHBranchTest,GHContentIntegrationTest,GHDeploymentTest,GHDiscussionTest,GHEventPayloadTest,GHGistTest,GHGistUpdaterTest,GHIssueEventAttributeTest,GHIssueEventTest,GHLicenseTest,GHMarketplacePlanTest,GHMilestoneTest,GHObjectTest,GHOrganizationTest,GHPersonTest,GHProjectCardTest,GHProjectColumnTest,GHProjectTest,GHPullRequestTest,GHRateLimitTest,GHReleaseTest,GHRepositoryStatisticsTest,GHRepositoryTest,GHTagTest,GHTeamBuilderTest,GHTeamTest,GHTreeBuilderTest,GHUserTest,GHVerificationReasonTest,GHWorkflowRunTest,GHWorkflowTest,Github2faTest,GitHubCachingTest,GitHubCachingTest,GitHubConnectionTest,GitHubStaticTest,GitHubTest,JWTTokenProviderTest,LifecycleTest,OkHttpConnectorTest,OkHttpConnectorTest,RateLimitCheckerTest,RateLimitHandlerTest,RepositoryTrafficTest,RequesterRetryTest,WireMockStatusReporterTest
public abstract class AbstractGitHubWireMockTest extends Object
- Author:
- Liam Newman
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractGitHubWireMockTest.TemplatingHelper
-
Field Summary
Fields Modifier and Type Field Description protected StringbaseFilesClassPathprotected StringbaseRecordPathprotected GitHubgitHubGitHubinstance for use during test.GitHubWireMockRulemockGitHubprotected Set<String>tempGitHubRepositoriesprotected AbstractGitHubWireMockTest.TemplatingHelpertemplatingprotected booleanuseDefaultGitHub
-
Constructor Summary
Constructors Constructor Description AbstractGitHubWireMockTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidassertThat(String reason, boolean assertion)static <T> voidassertThat(String reason, T actual, org.hamcrest.Matcher<? super T> matcher)static <T> voidassertThat(T actual, org.hamcrest.Matcher<? super T> matcher)protected voidcleanupRepository(String fullName)voidcleanupTempRepositories()static voidfail()static voidfail(String reason)protected GitHubBuildergetGitHubBuilder()GitHubgetNonRecordingGitHub()GitHubinstance for use before/after test.protected GHRepositorygetTempRepository()Creates a temporary repository that will be deleted at the end of the test.protected GHRepositorygetTempRepository(String name)Creates a temporary repository that will be deleted at the end of the test.protected GHUsergetUser()protected static GHUsergetUser(GitHub gitHub)protected com.github.tomakehurst.wiremock.core.WireMockConfigurationgetWireMockOptions()protected voidkohsuke()protected voidrequireProxy(String reason)protected voidsnapshotNotAllowed()protected voidverifyAuthenticated(GitHub instance)voidwireMockSetup()
-
-
-
Field Detail
-
useDefaultGitHub
protected boolean useDefaultGitHub
-
gitHub
protected GitHub gitHub
GitHubinstance for use during test. Traffic will be part of snapshot when taken.
-
baseFilesClassPath
protected final String baseFilesClassPath
-
baseRecordPath
protected final String baseRecordPath
-
mockGitHub
public final GitHubWireMockRule mockGitHub
-
templating
protected final AbstractGitHubWireMockTest.TemplatingHelper templating
-
-
Method Detail
-
getWireMockOptions
protected com.github.tomakehurst.wiremock.core.WireMockConfiguration getWireMockOptions()
-
getGitHubBuilder
protected GitHubBuilder getGitHubBuilder()
-
snapshotNotAllowed
protected void snapshotNotAllowed()
-
requireProxy
protected void requireProxy(String reason)
-
verifyAuthenticated
protected void verifyAuthenticated(GitHub instance)
-
getUser
protected GHUser getUser()
-
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 the repository- Returns:
- a temporary repository
- Throws:
IOException- if repository could not be created or retrieved.
-
cleanupTempRepositories
public void cleanupTempRepositories() throws IOException- Throws:
IOException
-
cleanupRepository
protected void cleanupRepository(String fullName) throws IOException
- Throws:
IOException
-
getNonRecordingGitHub
public GitHub getNonRecordingGitHub()
GitHubinstance 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()
-
fail
public static void fail()
-
fail
public static void fail(String reason)
-
assertThat
public static <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher)
-
assertThat
public static <T> void assertThat(String reason, T actual, org.hamcrest.Matcher<? super T> matcher)
-
assertThat
public static void assertThat(String reason, boolean assertion)
-
-