Skip to content
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

convert twilio unit test from groovy to java #13077

Merged
merged 7 commits into from
Jan 24, 2025

Conversation

shalk
Copy link
Contributor

@shalk shalk commented Jan 21, 2025

relate to #7195

@shalk shalk requested a review from a team as a code owner January 21, 2025 07:26

@Test
void synchronousMessage() {
twilioRestClient = mock(TwilioRestClient.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can skip this if you add @ExtendWith(MockitoExtension.class) to the test class and @Mock to the twilioRestClient field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 216 to 217
CloseableHttpResponse response1 = mockResponse(MESSAGE_RESPONSE_BODY, 200);
when(httpClient.execute(any())).thenReturn(response1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename response1 -> response or inline it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


@Test
void httpClient() throws IOException {
CloseableHttpClient httpClient = mock(CloseableHttpClient.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to duplicated definitions in three different unit tests, how about extracting it out like twilioRestClient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@laurit laurit merged commit 9e70f93 into open-telemetry:main Jan 24, 2025
57 of 58 checks passed
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.

5 participants