@@ -43,18 +43,13 @@ public class VisualRegressionTrackerTest {
4343
4444 private final static String BUILD_ID = "123123" ;
4545 private final static String PROJECT_ID = "projectId" ;
46+ private final static String CI_BUILD_ID = "123456789" ;
4647 private final static String NAME = "Test name" ;
4748 private final static String IMAGE_BASE_64 = "image" ;
4849
4950 private final Gson gson = new Gson ();
50- private final VisualRegressionTrackerConfig config = new VisualRegressionTrackerConfig (
51- "http://localhost" ,
52- "733c148e-ef70-4e6d-9ae5-ab22263697cc" ,
53- "XHGDZDFD3GMJDNM87JKEMP0JS1G5" ,
54- "develop" ,
55- false
56- );
5751
52+ private VisualRegressionTrackerConfig config ;
5853 private MockWebServer server ;
5954 private VisualRegressionTracker vrt ;
6055 private VisualRegressionTracker vrtMocked ;
@@ -66,7 +61,13 @@ public void setup() {
6661 server .start ();
6762
6863 // target to mock server
69- this .config .setApiUrl (server .url ("/" ).toString ());
64+ config = new VisualRegressionTrackerConfig (
65+ server .url ("/" ).toString (),
66+ "733c148e-ef70-4e6d-9ae5-ab22263697cc" ,
67+ "XHGDZDFD3GMJDNM87JKEMP0JS1G5" ,
68+ "develop" ,
69+ false ,
70+ CI_BUILD_ID );
7071 vrt = new VisualRegressionTracker (config );
7172 vrtMocked = mock (VisualRegressionTracker .class );
7273 vrtMocked .paths = new PathProvider ("baseApiUrl" );
@@ -84,10 +85,12 @@ public void shouldStartBuild() throws IOException, InterruptedException {
8485 BuildRequest buildRequest = BuildRequest .builder ()
8586 .branchName (this .config .getBranchName ())
8687 .project (this .config .getProject ())
88+ .ciBuildId (this .config .getCiBuildId ())
8789 .build ();
8890 BuildResponse buildResponse = BuildResponse .builder ()
8991 .id (BUILD_ID )
9092 .projectId (PROJECT_ID )
93+ .ciBuildId (CI_BUILD_ID )
9194 .build ();
9295 server .enqueue (new MockResponse ()
9396 .setResponseCode (200 )
@@ -209,7 +212,15 @@ public Object[][] trackErrorCases() {
209212 expectedExceptions = TestRunException .class ,
210213 expectedExceptionsMessageRegExp = "^(Difference found: https://someurl.com/test/123123|No baseline: https://someurl.com/test/123123)$" )
211214 public void trackShouldThrowException (TestRunResponse testRunResponse , String expectedExceptionMessage ) throws IOException {
212- vrtMocked .configuration = new VisualRegressionTrackerConfig ("" , "" , "" , "" , false );
215+ vrtMocked .configuration = VisualRegressionTrackerConfig .builder ()
216+ .apiUrl ("" )
217+ .project ("" )
218+ .apiKey ("" )
219+ .branchName ("" )
220+ .enableSoftAssert (false )
221+ .ciBuildId ("" )
222+ .build ();
223+
213224 when (vrtMocked .submitTestRun (anyString (), anyString (), any ())).thenReturn (testRunResponse );
214225
215226 doCallRealMethod ().when (vrtMocked ).track (anyString (), anyString (), any ());
@@ -224,7 +235,14 @@ public void trackShouldLogSevere(TestRunResponse testRunResponse, String expecte
224235 listAppender .start ();
225236 // add the appender to the logger
226237 loggerMock .addAppender (listAppender );
227- vrtMocked .configuration = new VisualRegressionTrackerConfig ("" , "" , "" , "" , true );
238+ vrtMocked .configuration = VisualRegressionTrackerConfig .builder ()
239+ .apiUrl ("" )
240+ .project ("" )
241+ .apiKey ("" )
242+ .branchName ("" )
243+ .enableSoftAssert (true )
244+ .ciBuildId ("" )
245+ .build ();
228246 when (vrtMocked .submitTestRun (anyString (), anyString (), any ())).thenReturn (testRunResponse );
229247
230248 doCallRealMethod ().when (vrtMocked ).track (anyString (), anyString (), any ());
0 commit comments