Skip to content

Commit c1ec413

Browse files
authored
Merge pull request #1 from dp120291ssv/fix_issue_50
fix the issue - https://github.com/Visual-Regression-Tracker/Visual-R…
2 parents 0eaa732 + 3837c6d commit c1ec413

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@
99

1010
public class VisualRegressionTracker {
1111
static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
12-
Config config;
12+
VisualRegressionTrackerConfig visualRegressionTrackerConfig;
1313
String buildId;
1414
OkHttpClient client;
1515

16-
public VisualRegressionTracker(Config config) {
17-
this.config = config;
16+
public VisualRegressionTracker(VisualRegressionTrackerConfig visualRegressionTrackerConfig) {
17+
this.visualRegressionTrackerConfig = visualRegressionTrackerConfig;
1818

1919
this.client = new OkHttpClient();
2020
}
2121

2222
void startBuild() throws IOException {
2323
if (this.buildId == null) {
2424
Map<String, String> data = new HashMap<>();
25-
data.put("projectId", this.config.projectId);
26-
data.put("branchName", this.config.branchName);
25+
data.put("projectId", this.visualRegressionTrackerConfig.projectId);
26+
data.put("branchName", this.visualRegressionTrackerConfig.branchName);
2727

2828
RequestBody body = RequestBody.create(new Gson().toJson(data), JSON);
2929

3030
Request request = new Request.Builder()
31-
.url(this.config.apiUrl.concat("/builds"))
32-
.addHeader("apiKey", this.config.apiKey)
31+
.url(this.visualRegressionTrackerConfig.apiUrl.concat("/builds"))
32+
.addHeader("apiKey", this.visualRegressionTrackerConfig.apiKey)
3333
.post(body)
3434
.build();
3535

@@ -42,7 +42,7 @@ void startBuild() throws IOException {
4242

4343
TestResultDTO submitTestRun(String name, String imageBase64, TestRunOptions testRunOptions) throws IOException {
4444
Map<String, Object> data = new HashMap<>();
45-
data.put("projectId", this.config.projectId);
45+
data.put("projectId", this.visualRegressionTrackerConfig.projectId);
4646
data.put("buildId", this.buildId);
4747
data.put("name", name);
4848
data.put("imageBase64", imageBase64);
@@ -55,8 +55,8 @@ TestResultDTO submitTestRun(String name, String imageBase64, TestRunOptions test
5555
RequestBody body = RequestBody.create(new Gson().toJson(data), JSON);
5656

5757
Request request = new Request.Builder()
58-
.url(this.config.apiUrl.concat("/test"))
59-
.addHeader("apiKey", this.config.apiKey)
58+
.url(this.visualRegressionTrackerConfig.apiUrl.concat("/test"))
59+
.addHeader("apiKey", this.visualRegressionTrackerConfig.apiKey)
6060
.post(body)
6161
.build();
6262

src/main/java/io/visual_regression_tracker/sdk_java/Config.java renamed to src/main/java/io/visual_regression_tracker/sdk_java/VisualRegressionTrackerConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import lombok.AllArgsConstructor;
44

55
@AllArgsConstructor
6-
public class Config {
6+
public class VisualRegressionTrackerConfig {
77
String apiUrl;
88
String projectId;
99
String apiKey;

0 commit comments

Comments
 (0)