Skip to content

Commit

Permalink
Add static imports for helpers in ReleaseTrackAssignmentBuilderTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
orrc committed May 22, 2020
1 parent 3d546a7 commit 22fac28
Showing 1 changed file with 13 additions and 12 deletions.
Expand Up @@ -13,7 +13,6 @@
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.JenkinsUtil;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestHttpTransport;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestUtilImpl;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.responses.FakeAssignTrackResponse;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.responses.FakeCommitResponse;
import org.jenkinsci.plugins.googleplayandroidpublisher.internal.responses.FakeListApksResponse;
Expand All @@ -34,7 +33,9 @@
import java.util.List;
import java.util.stream.Stream;

import static org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper.assertLogLines;
import static org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper.assertResultWithLogLines;
import static org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper.createAndroidPublisher;
import static org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper.getRequestBodyForUrl;
import static org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper.release;
import static org.jenkinsci.plugins.googleplayandroidpublisher.internal.TestsHelper.setUpCredentials;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void setUp() throws Exception {
when(mockAndroid.getApkPackageName(any())).thenReturn("org.jenkins.appId");

// Create fake AndroidPublisher client
AndroidPublisher androidClient = TestsHelper.createAndroidPublisher(transport);
AndroidPublisher androidClient = createAndroidPublisher(transport);
when(jenkinsUtil.createPublisherClient(any(), anyString())).thenReturn(androidClient);

Util.setAndroidUtil(mockAndroid);
Expand All @@ -78,9 +79,9 @@ public void tearDown() throws Exception {
@Test
public void configRoundtripWorks() throws Exception {
// Given that a few credentials have been set up
TestsHelper.setUpCredentials("credential-a");
TestsHelper.setUpCredentials("credential-b");
TestsHelper.setUpCredentials("credential-c");
setUpCredentials("credential-a");
setUpCredentials("credential-b");
setUpCredentials("credential-c");

// And we have a job configured with the builder, which includes all possible configuration options
FreeStyleProject project = j.createFreeStyleProject();
Expand Down Expand Up @@ -182,7 +183,7 @@ public void moveApkTrack_succeeds() throws Exception {
QueueTaskFuture<FreeStyleBuild> scheduled = p.scheduleBuild2(0);
j.assertBuildStatusSuccess(scheduled);

TestsHelper.assertLogLines(j, scheduled,
assertLogLines(j, scheduled,
"Assigning 1 version(s) with application ID org.jenkins.appId to production release track",
"Setting rollout to target 5% of production track users",
"The production release track will now contain the version code(s): 42",
Expand All @@ -209,11 +210,11 @@ public void movingApkTrackAsDraftSucceeds() throws Exception {
p.getBuildersList().add(builder);

// And the prerequisites are in place
TestsHelper.setUpCredentials("test-credentials");
setUpCredentials("test-credentials");
setUpTransportForSuccess();

// When a build occurs, it should create the release in the target track as a draft
TestsHelper.assertResultWithLogLines(j, p, Result.SUCCESS,
assertResultWithLogLines(j, p, Result.SUCCESS,
"New production draft release created, with the version code(s): 42",
"Changes were successfully applied to Google Play"
);
Expand Down Expand Up @@ -367,10 +368,10 @@ private void moveApkTrackWithPipelineAndAssertResult(
"}", true
));

TestsHelper.setUpCredentials("test-credentials");
setUpCredentials("test-credentials");
setUpTransportForSuccess();

TestsHelper.assertResultWithLogLines(j, p, expectedResult, expectedLogLines);
assertResultWithLogLines(j, p, expectedResult, expectedLogLines);
}

@Test
Expand Down Expand Up @@ -410,7 +411,7 @@ public void moveApkTrack_fromSlave_succeeds() throws Exception {
QueueTaskFuture<FreeStyleBuild> scheduled = p.scheduleBuild2(0);
j.assertBuildStatusSuccess(scheduled);

TestsHelper.assertLogLines(j, scheduled,
assertLogLines(j, scheduled,
"Assigning 1 version(s) with application ID org.jenkins.appId to production release track",
"Setting rollout to target 5% of production track users",
"The production release track will now contain the version code(s): 42",
Expand Down Expand Up @@ -442,7 +443,7 @@ private void setUpTransportForSuccess() {

private ReleaseTrackAssignmentBuilder createBuilder() throws Exception {
ReleaseTrackAssignmentBuilder builder = new ReleaseTrackAssignmentBuilder();
TestsHelper.setUpCredentials("test-credentials");
setUpCredentials("test-credentials");
builder.setGoogleCredentialsId("test-credentials");
builder.setApplicationId("org.jenkins.appId");
builder.setVersionCodes("42");
Expand Down

0 comments on commit 22fac28

Please sign in to comment.