Conversation
keshavdandeva
approved these changes
Mar 16, 2026
Contributor
Author
|
/gemini review |
Contributor
There was a problem hiding this comment.
Code Review
The pull request migrates the google-cloud-bigquery-jdbc module's test suite from JUnit 4 to JUnit 5. This involves updating pom.xml to replace JUnit 4 dependencies with JUnit 5 Jupiter dependencies and Mockito's JUnit 5 extension. Test classes were refactored to use JUnit 5 annotations such as @Test, @BeforeEach, @AfterAll, @BeforeAll, @ParameterizedTest, @MethodSource, @RegisterExtension, @ExtendWith, @Nested, @TestInstance, and Assertions for assertions, replacing their JUnit 4 counterparts. Additionally, the TimeZoneRule was adapted to implement JUnit 5 extension interfaces.
Comment on lines
+65
to
+68
| import org.junit.jupiter.api.extension.RegisterExtension; | ||
| import org.junit.jupiter.api.function.Executable; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.MethodSource; |
Contributor
Comment on lines
+228
to
+237
| @ParameterizedTest(name = "{index}: primitive array of {0}") | ||
| @MethodSource("data") | ||
| public void getArray( | ||
| StandardSQLTypeName currentType, | ||
| Tuple<Field, JsonStringArrayList<?>> schemaAndValue, | ||
| Object[] expected, | ||
| int javaSqlTypeCode) | ||
| throws SQLException { | ||
| Array array = new BigQueryArrowArray(schemaAndValue.x(), schemaAndValue.y()); | ||
| assertThat(array.getArray()).isEqualTo(expected); |
Contributor
Comment on lines
+40
to
44
| @ParameterizedTest(name = "{index}: {0}") | ||
| @MethodSource("data") | ||
| public void stringToBoolean(String label, BigQueryTypeCoercer bigQueryTypeCoercer) { | ||
| assertThat(bigQueryTypeCoercer.coerceTo(Boolean.class, "true")).isTrue(); | ||
| assertThat(bigQueryTypeCoercer.coerceTo(Boolean.class, "false")).isFalse(); |
Contributor
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
| @RunWith(Parameterized.class) | ||
| public class BigQueryArrowArrayOfPrimitivesTest { |
Contributor
| private final int javaSqlTypeCode; | ||
| private Array array; | ||
| private final StandardSQLTypeName currentType; | ||
| @RegisterExtension public static final TimeZoneRule timeZoneRule = new TimeZoneRule("UTC"); |
Contributor
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
| @RunWith(Parameterized.class) | ||
| public class BigQueryDefaultCoercionsTest { |
Contributor
Comment on lines
+37
to
+40
| public void beforeAll(ExtensionContext context) { | ||
| defaultTimeZone = TimeZone.getDefault(); | ||
| TimeZone.setDefault(TimeZone.getTimeZone(timeZoneId)); | ||
| } |
Contributor
| } | ||
|
|
||
| @Override | ||
| public void afterAll(ExtensionContext context) { |
Contributor
Comment on lines
+48
to
+52
| public void beforeEach(ExtensionContext context) { | ||
| if (defaultTimeZone == null) { | ||
| defaultTimeZone = TimeZone.getDefault(); | ||
| } | ||
| TimeZone.setDefault(TimeZone.getTimeZone(timeZoneId)); |
Contributor
Comment on lines
55
to
+59
| @Override | ||
| public Statement apply(Statement base, Description description) { | ||
| return new Statement() { | ||
| @Override | ||
| public void evaluate() throws Throwable { | ||
| try { | ||
| TimeZone.setDefault(TimeZone.getTimeZone(timeZoneId)); | ||
| base.evaluate(); | ||
| } finally { | ||
| TimeZone.setDefault(defaultTimeZone); | ||
| } | ||
| } | ||
| }; | ||
| public void afterEach(ExtensionContext context) { | ||
| if (defaultTimeZone != null) { | ||
| TimeZone.setDefault(defaultTimeZone); | ||
| } |
Contributor
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.
No description provided.