Skip to content

Commit 6f3b630

Browse files
authored
build response returned after start (#53)
#52
1 parent d613b44 commit 6f3b630

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTracker.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public VisualRegressionTracker(VisualRegressionTrackerConfig trackerConfig) {
4040
gson = new Gson();
4141
}
4242

43-
public void start() throws IOException {
43+
public BuildResponse start() throws IOException {
4444
String projectName = configuration.getProject();
4545
String branch = configuration.getBranchName();
4646
String ciBuildId = configuration.getCiBuildId();
@@ -70,6 +70,7 @@ public void start() throws IOException {
7070

7171
log.info("Visual Regression Tracker is started for project <{}>: buildId: <{}>, projectId: <{}>, ciBuildId: <{}>",
7272
projectName, projectId, buildId, buildResponse.getCiBuildId());
73+
return buildResponse;
7374
}
7475

7576
public void stop() throws IOException {

src/test/java/io/visual_regression_tracker/sdk_java/VisualRegressionTrackerTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,16 @@ public void shouldStartBuild() throws IOException, InterruptedException {
100100
.setResponseCode(200)
101101
.setBody(gson.toJson(buildResponse)));
102102

103-
vrt.start();
103+
BuildResponse result = vrt.start();
104104

105105
RecordedRequest recordedRequest = server.takeRequest();
106106
assertThat(recordedRequest.getHeader(VisualRegressionTracker.API_KEY_HEADER), is(config.getApiKey()));
107107
assertThat(recordedRequest.getBody().readUtf8(), is(gson.toJson(buildRequest)));
108108
assertThat(vrt.buildId, is(BUILD_ID));
109109
assertThat(vrt.projectId, is(PROJECT_ID));
110+
assertThat(result.getId(), is(BUILD_ID));
111+
assertThat(result.getProjectId(), is(PROJECT_ID));
112+
assertThat(result.getCiBuildId(), is(CI_BUILD_ID));
110113
}
111114

112115
@Test

0 commit comments

Comments
 (0)