Skip to content

Updating DDB tests to assert on correct value. Adding in getMessage o… #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ public AwsErrorDetails awsErrorDetails() {
return awsErrorDetails;
}

@Override
public String getMessage() {
if (awsErrorDetails != null) {
return awsErrorDetails().errorMessage() +
" (Service: " + awsErrorDetails().serviceName() +
", Status Code: " + statusCode() +
", Request ID: " + requestId() + ")";
}

return super.getMessage();
}

@Override
public boolean isClockSkewException() {
return Optional.ofNullable(awsErrorDetails)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testResourceNotFoundException() {
Assert.fail("ResourceNotFoundException is expected.");
} catch (ResourceNotFoundException e) {
Assert.assertNotNull(e.awsErrorDetails().errorCode());
Assert.assertNotNull(e.getMessage());
Assert.assertNotNull(e.awsErrorDetails().errorMessage());
Assert.assertNotNull(e.awsErrorDetails().rawResponse());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void testErrorHandling() throws Exception {
fail("Expected an exception to be thrown");
} catch (AwsServiceException exception) {
assertNotEmpty(exception.awsErrorDetails().errorCode());
assertNotEmpty(exception.getMessage());
assertNotEmpty(exception.awsErrorDetails().errorMessage());
assertNotEmpty(exception.requestId());
assertNotEmpty(exception.awsErrorDetails().serviceName());
assertTrue(exception.statusCode() >= 400);
Expand Down Expand Up @@ -209,7 +209,7 @@ public void testBatchWriteTooManyItemsErrorHandling() throws Exception {
dynamo.batchWriteItem(BatchWriteItemRequest.builder().requestItems(requestItems).build());
} catch (AwsServiceException exception) {
assertEquals("ValidationException", exception.awsErrorDetails().errorCode());
assertNotEmpty(exception.getMessage());
assertNotEmpty(exception.awsErrorDetails().errorMessage());
assertNotEmpty(exception.requestId());
assertNotEmpty(exception.awsErrorDetails().serviceName());
assertEquals(400, exception.statusCode());
Expand Down