Skip to content

Conversation

G8XSU
Copy link
Contributor

@G8XSU G8XSU commented May 25, 2023

Depends on #10

@G8XSU G8XSU requested a review from jkczyz May 25, 2023 07:26
}

@Test
void execute_ValidPayload_ReturnsResponse() {
Copy link
Contributor Author

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.

Copy link
Contributor Author

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"));
Copy link
Contributor

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?

@G8XSU
Copy link
Contributor Author

G8XSU commented Jun 14, 2023

Hi @jkczyz
Will you be reviewing #10 separately or should i merge just this combined PR ?

@jkczyz
Copy link
Contributor

jkczyz commented Jun 15, 2023

Hi @jkczyz Will you be reviewing #10 separately or should i merge just this combined PR ?

I think you can just merged the combined PR and close #10.

@G8XSU G8XSU merged commit 16818cf into lightningdevkit:main Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants