@@ -295,10 +295,10 @@ void given__instanceWithServer__when__updatingCloud__then__cloudAdded() {
295
295
@ Test
296
296
void given__instanceWithServer__when__updatingDifferentServer__then__serverAdded () {
297
297
BitbucketEndpointConfiguration instance = new BitbucketEndpointConfiguration ();
298
- instance .setEndpoints (List .of (new BitbucketServerEndpoint ("Example Inc" , "https://bitbucket.example.com/" , true , "dummy" )));
298
+ instance .setEndpoints (List .of (new BitbucketServerEndpoint ("Example Inc" , "https://bitbucket.example.com/" , true , "dummy" , false , null )));
299
299
assumeTrue ("dummy" .equals (instance .getEndpoints ().get (0 ).getCredentialsId ()));
300
300
301
- instance .updateEndpoint (new BitbucketServerEndpoint ("Example Org" , "http://example.org:8080/bitbucket/" , true , "added" ));
301
+ instance .updateEndpoint (new BitbucketServerEndpoint ("Example Org" , "http://example.org:8080/bitbucket/" , true , "added" , false , null ));
302
302
303
303
assertThat (instance .getEndpoints ()).hasOnlyElementsOfType (BitbucketServerEndpoint .class );
304
304
assertThat (instance .getEndpoints ()).element (0 ).satisfies (endpoint -> {
@@ -328,8 +328,13 @@ void given__instanceWithServer__when__updatingSameServer__then__serverUpdated()
328
328
@ Test
329
329
void given__newInstance__when__removingCloud__then__defaultRestored () {
330
330
BitbucketEndpointConfiguration instance = new BitbucketEndpointConfiguration ();
331
- assertThat (instance .getEndpoints ().get (0 ).getCredentialsId ()).isNull ();
332
- assertThat (instance .removeEndpoint (buildEndpoint (true , "dummy" ))).isTrue ();
331
+ // verify there is always a default endpoint
332
+ assertThat (instance .getEndpoints ()).isNotEmpty ()
333
+ .element (0 )
334
+ .satisfies (endpoint -> assertThat (endpoint .getCredentialsId ()).isNull ());
335
+ // remove default does not really remove it
336
+ assertThat (instance .removeEndpoint (buildEndpoint (true , "dummy" ))).isFalse ();
337
+ // default always exists
333
338
assertThat (instance .getEndpoints ()).hasOnlyElementsOfType (BitbucketCloudEndpoint .class );
334
339
}
335
340
@@ -415,8 +420,7 @@ void given__instance__when__multipleEndpoints__then__endpointsSelectable() {
415
420
416
421
@ Test
417
422
void given__instanceWithCloudAndServers__when__findingExistingEndpoint__then__endpointFound () {
418
- BitbucketEndpointConfiguration instance = new BitbucketEndpointConfiguration ();
419
- instance .setEndpoints (
423
+ BitbucketEndpointConfiguration .get ().setEndpoints (
420
424
Arrays .asList (
421
425
buildEndpoint (true , "first" ),
422
426
new BitbucketServerEndpoint ("Example Inc" , "https://bitbucket.example.com/" , true , "second" ),
@@ -445,8 +449,7 @@ void given__instanceWithCloudAndServers__when__findingExistingEndpoint__then__en
445
449
446
450
@ Test
447
451
void given__instanceWithServers__when__findingNonExistingEndpoint__then__endpointNotFound () {
448
- BitbucketEndpointConfiguration instance = new BitbucketEndpointConfiguration ();
449
- instance .setEndpoints (
452
+ BitbucketEndpointConfiguration .get ().setEndpoints (
450
453
Arrays .<AbstractBitbucketEndpoint >asList (
451
454
new BitbucketServerEndpoint ("Example Inc" , "https://bitbucket.example.com/" , true , "dummy" ),
452
455
new BitbucketServerEndpoint ("Example Org" , "http://example.org:8080/bitbucket/" , true , "dummy" )
@@ -463,8 +466,7 @@ void given__instanceWithServers__when__findingNonExistingEndpoint__then__endpoin
463
466
464
467
@ Test
465
468
void given__instanceWithCloudAndServers__when__findingInvalid__then__endpointNotFound () {
466
- BitbucketEndpointConfiguration instance = new BitbucketEndpointConfiguration ();
467
- instance .setEndpoints (
469
+ BitbucketEndpointConfiguration .get ().setEndpoints (
468
470
Arrays .asList (
469
471
buildEndpoint (true , "first" ),
470
472
new BitbucketServerEndpoint ("Example Inc" , "https://bitbucket.example.com/" , true , "second" ),
@@ -526,7 +528,7 @@ void given__instanceWithCloudAndServers__when__resolvingNewEndpointAsSystem__the
526
528
r .jenkins .setAuthorizationStrategy (mockStrategy );
527
529
try (ACLContext context = ACL .as2 (ACL .SYSTEM2 )) {
528
530
BitbucketEndpointConfiguration instance = new BitbucketEndpointConfiguration ();
529
- instance .setEndpoints (List .of (new BitbucketServerEndpoint ("existing" , "https://bitbucket.test" , false , null )));
531
+ instance .setEndpoints (List .of (new BitbucketServerEndpoint ("existing" , "https://bitbucket.test" , false , null , false , null )));
530
532
assertThat (instance .getEndpointItems ()).hasSize (1 );
531
533
assertThat (instance .readResolveServerUrl (null )).isEqualTo (BitbucketCloudEndpoint .SERVER_URL );
532
534
assertThat (instance .getEndpointItems ()).hasSize (2 );
0 commit comments