@@ -107,15 +107,15 @@ public void happyCase() {
107107 //
108108 // Now reset expectation to fail with already exists
109109 //
110- final ExistsException exists = new ExistsException (mock (AwsServiceException .Builder . class )) {
110+ final ExistsException exists = new ExistsException (new AwsServiceException (AwsServiceException .builder ( )) {
111111 private static final long serialVersionUID = 1L ;
112112
113113 @ Override
114114 public AwsErrorDetails awsErrorDetails () {
115115 return AwsErrorDetails .builder ().errorCode ("AlreadyExists" ).errorMessage ("Repo already exists" )
116116 .sdkHttpResponse (sdkHttpResponse ).build ();
117117 }
118- };
118+ }. toBuilder ()) ;
119119 when (serviceClient .createRepository (any (CreateRequest .class ))).thenThrow (exists );
120120 StdCallbackContext newContext = new StdCallbackContext ();
121121 event = proxy .initiate ("client:createRepository" , client , model , newContext )
@@ -124,7 +124,7 @@ public AwsErrorDetails awsErrorDetails() {
124124 .done (r -> ProgressEvent .success (model , context ));
125125
126126 assertThat (event .getStatus ()).isEqualTo (OperationStatus .FAILED );
127- assertThat (event .getMessage ()).contains ("AlreadyExists " );
127+ assertThat (event .getMessage ()).contains ("Repo already exists " );
128128 }
129129
130130 private HandlerRequest <Model , StdCallbackContext > prepareRequest (Model model ) throws Exception {
@@ -196,15 +196,15 @@ public void notFound() throws Exception {
196196 final DescribeRequest describeRequest = new DescribeRequest .Builder ().repoName (model .getRepoName ()).overrideConfiguration (
197197 AwsRequestOverrideConfiguration .builder ().credentialsProvider (StaticCredentialsProvider .create (MockCreds )).build ())
198198 .build ();
199- final NotFoundException notFound = new NotFoundException (mock (AwsServiceException .Builder . class )) {
199+ final NotFoundException notFound = new NotFoundException (new AwsServiceException (AwsServiceException .builder ( )) {
200200 private static final long serialVersionUID = 1L ;
201201
202202 @ Override
203203 public AwsErrorDetails awsErrorDetails () {
204204 return AwsErrorDetails .builder ().errorCode ("NotFound" ).errorMessage ("Repo not existing" )
205205 .sdkHttpResponse (sdkHttpResponse ).build ();
206206 }
207- };
207+ }. toBuilder ()) ;
208208 when (client .describeRepository (eq (describeRequest ))).thenThrow (notFound );
209209
210210 final SdkHttpClient httpClient = mock (SdkHttpClient .class );
@@ -221,7 +221,7 @@ public AwsErrorDetails awsErrorDetails() {
221221 });
222222 assertThat (response ).isNotNull ();
223223 assertThat (response .getStatus ()).isEqualTo (OperationStatus .FAILED );
224- assertThat (response .getMessage ()).contains ("NotFound " );
224+ assertThat (response .getMessage ()).contains ("Repo not existing " );
225225 }
226226
227227 @ SuppressWarnings ("unchecked" )
@@ -299,15 +299,15 @@ public void createHandlerAlreadyExists() throws Exception {
299299 final SdkHttpResponse sdkHttpResponse = mock (SdkHttpResponse .class );
300300 when (sdkHttpResponse .statusCode ()).thenReturn (500 );
301301
302- final ExistsException exists = new ExistsException (mock (AwsServiceException .Builder . class )) {
302+ final ExistsException exists = new ExistsException (new AwsServiceException (AwsServiceException .builder ( )) {
303303 private static final long serialVersionUID = 1L ;
304304
305305 @ Override
306306 public AwsErrorDetails awsErrorDetails () {
307307 return AwsErrorDetails .builder ().errorCode ("AlreadyExists" ).errorMessage ("Repo already exists" )
308308 .sdkHttpResponse (sdkHttpResponse ).build ();
309309 }
310- };
310+ }. toBuilder ()) ;
311311 when (client .createRepository (eq (createRequest ))).thenThrow (exists );
312312
313313 final SdkHttpClient httpClient = mock (SdkHttpClient .class );
@@ -327,7 +327,7 @@ public AwsErrorDetails awsErrorDetails() {
327327 assertThat (request .getRequestData ()).isNotNull ();
328328 Model responseModel = response .getResourceModel ();
329329 assertThat (responseModel .getRepoName ()).isEqualTo ("repository" );
330- assertThat (response .getMessage ()).contains ("AlreadyExists " );
330+ assertThat (response .getMessage ()).contains ("Repo already exists " );
331331 }
332332
333333 @ Order (30 )
@@ -469,7 +469,7 @@ public void accessDenied() throws Exception {
469469 final DescribeRequest describeRequest = new DescribeRequest .Builder ().repoName (model .getRepoName ()).overrideConfiguration (
470470 AwsRequestOverrideConfiguration .builder ().credentialsProvider (StaticCredentialsProvider .create (MockCreds )).build ())
471471 .build ();
472- final AccessDenied accessDenied = new AccessDenied (mock (AwsServiceException .Builder . class )) {
472+ final AccessDenied accessDenied = new AccessDenied (new AwsServiceException (AwsServiceException .builder ( )) {
473473 private static final long serialVersionUID = 1L ;
474474
475475 @ Override
@@ -478,7 +478,7 @@ public AwsErrorDetails awsErrorDetails() {
478478 .sdkHttpResponse (sdkHttpResponse ).build ();
479479 }
480480
481- };
481+ }. toBuilder ()) ;
482482 when (client .describeRepository (eq (describeRequest ))).thenThrow (accessDenied );
483483
484484 final SdkHttpClient httpClient = mock (SdkHttpClient .class );
@@ -495,7 +495,7 @@ public AwsErrorDetails awsErrorDetails() {
495495 });
496496 assertThat (response ).isNotNull ();
497497 assertThat (response .getStatus ()).isEqualTo (OperationStatus .FAILED );
498- assertThat (response .getMessage ()).contains ("AccessDenied " );
498+ assertThat (response .getMessage ()).contains ("Token Invalid " );
499499 }
500500
501501}
0 commit comments