convert twilio unit test from groovy to java#13077
Merged
Merged
Conversation
jeanbisutti
reviewed
Jan 21, 2025
jaydeluca
reviewed
Jan 21, 2025
Co-authored-by: Jean Bisutti <jean.bisutti@gmail.com>
Co-authored-by: Jay DeLuca <jaydeluca4@gmail.com>
jaydeluca
approved these changes
Jan 22, 2025
laurit
reviewed
Jan 22, 2025
|
|
||
| @Test | ||
| void synchronousMessage() { | ||
| twilioRestClient = mock(TwilioRestClient.class); |
Contributor
There was a problem hiding this comment.
I think you can skip this if you add @ExtendWith(MockitoExtension.class) to the test class and @Mock to the twilioRestClient field.
laurit
reviewed
Jan 23, 2025
Comment on lines
+216
to
+217
| CloseableHttpResponse response1 = mockResponse(MESSAGE_RESPONSE_BODY, 200); | ||
| when(httpClient.execute(any())).thenReturn(response1); |
Contributor
There was a problem hiding this comment.
I'd rename response1 -> response or inline it.
steverao
reviewed
Jan 23, 2025
|
|
||
| @Test | ||
| void httpClient() throws IOException { | ||
| CloseableHttpClient httpClient = mock(CloseableHttpClient.class); |
Contributor
There was a problem hiding this comment.
Due to duplicated definitions in three different unit tests, how about extracting it out like twilioRestClient?
laurit
approved these changes
Jan 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
relate to #7195