-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add GetObjectApiTest, PutObjectsApiTest, ListKeyVersionsApiTest #12
Conversation
} | ||
|
||
@Test | ||
void execute_ValidPayload_ReturnsResponse() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tried creating a common base testcase but it was more complex and less readable since many api specific calls are interleaved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are the abstract methods a sub-test would have had to implement in that case, and it seemed difficult to understand test-case.
abstract void beforeEachSetup();
abstract void verifyAfterTest();
abstract GeneratedMessageV3 createExpectedRequest();
abstract GeneratedMessageV3 createExpectedResponse();
abstract Response executeValidRequest();
abstract Response executeErroringRequest(Class<? extends Exception> exceptionClass)
throws Exception;
.build(); | ||
byte[] payload = expectedRequest.toByteArray(); | ||
when(mockKVStore.get(any())).thenThrow( | ||
exceptionClass.getDeclaredConstructor(String.class).newInstance("errorMsg")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be simpler to pass in the constructed exception?
Depends on #10