Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a20a1eb
feat: Migrate to JUnit 5 and add parallel test execution
AbgarSim Dec 18, 2025
e1fadc8
feat: Migrate tests to JUnit5
lqiu96 Jan 7, 2026
f742f23
chore: Add surefire-junit-platform dep for ITs
lqiu96 Jan 7, 2026
12d049c
test: Enable parallel tests for JUnit5
lqiu96 Jan 7, 2026
1166bb8
chore: Fix broken tests
lqiu96 Jan 8, 2026
8710ba4
chore: Upgrade existing integration tests to JUnit 5 syntax and features
lqiu96 Jan 8, 2026
4cefb6c
chore: Upgrade ITNightlyBigQueryTest to JUnit 5 features and package-…
lqiu96 Jan 8, 2026
279246c
chore: Make the tests package-private
lqiu96 Jan 8, 2026
91dc238
feat: migrate tests to JUnit 5 assertThrows and static imports
lqiu96 Jan 8, 2026
6742a07
chore: Remove wildcard imports
lqiu96 Jan 8, 2026
a92c970
chore: revert samples to use junit4
lqiu96 Jan 8, 2026
5e6b61f
chore: Address code comments
lqiu96 Jan 8, 2026
2e7282d
chore: Close connection after test
lqiu96 Jan 8, 2026
64bd75f
Merge branch 'migrage-to-junit5' into junit5-parallel-tests
lqiu96 Jan 8, 2026
4949a6f
chore: Fix flaky tests
lqiu96 Jan 9, 2026
303c864
chore: Fix flaky tests
lqiu96 Jan 9, 2026
90b286b
Merge branch 'main' into junit5-parallel-tests
lqiu96 Jan 9, 2026
97f63be
chore: Fix tests
lqiu96 Jan 9, 2026
efa8185
chore: Disable cache for query stats
lqiu96 Jan 10, 2026
8f42e36
chore: Add unique id to each table
lqiu96 Jan 10, 2026
00029c8
chore: Use unique test table names
lqiu96 Jan 12, 2026
4a474bd
chore: Remove parallel test execution
lqiu96 Jan 12, 2026
73a615d
chore: Add comment for cache
lqiu96 Jan 12, 2026
a9de5af
chore: Fix broken test
lqiu96 Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions google-cloud-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,18 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -207,6 +217,20 @@

<build>
<plugins>
<!-- Declare `surefire-junit-platform` here as shared-configs pulls in surefire-junit47 -->
<!-- which is for JUnit4 and not JUnit5. Declare this here until upstream is fixed -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${surefire.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<!-- Allow script to run, so we can run benchmarks. -->
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import com.google.api.services.bigquery.model.MetadataCacheStatistics;
import com.google.common.collect.ImmutableList;
import com.google.common.truth.Truth;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class MetadataCacheStatsTest {
class MetadataCacheStatsTest {
private static List<com.google.api.services.bigquery.model.TableMetadataCacheUsage>
TABLE_METADATA_CACHE_USAGE_PB_LIST =
ImmutableList.of(
Expand All @@ -44,7 +44,7 @@ public class MetadataCacheStatsTest {
new MetadataCacheStatistics().setTableMetadataCacheUsage(TABLE_METADATA_CACHE_USAGE_PB_LIST);

@Test
public void testToPbAndFromPb() {
void testToPbAndFromPb() {
assertEquals(METADATA_CACHE_STATISTICS_PB, METADATA_CACHE_STATS.toPb());
compareMetadataCacheStats(
METADATA_CACHE_STATS, MetadataCacheStats.fromPb(METADATA_CACHE_STATISTICS_PB));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import com.google.api.services.bigquery.model.Dataset;
import com.google.cloud.bigquery.Acl.DatasetAclEntity;
Expand All @@ -31,12 +31,12 @@
import com.google.cloud.bigquery.Acl.View;
import com.google.common.collect.ImmutableList;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class AclTest {
class AclTest {

@Test
public void testDatasetEntity() {
void testDatasetEntity() {
DatasetId datasetId = DatasetId.of("dataset");
List<String> targetTypes = ImmutableList.of("VIEWS");
DatasetAclEntity entity = new DatasetAclEntity(datasetId, targetTypes);
Expand All @@ -47,7 +47,7 @@ public void testDatasetEntity() {
}

@Test
public void testDomainEntity() {
void testDomainEntity() {
Domain entity = new Domain("d1");
assertEquals("d1", entity.getDomain());
assertEquals(Type.DOMAIN, entity.getType());
Expand All @@ -56,7 +56,7 @@ public void testDomainEntity() {
}

@Test
public void testGroupEntity() {
void testGroupEntity() {
Group entity = new Group("g1");
assertEquals("g1", entity.getIdentifier());
assertEquals(Type.GROUP, entity.getType());
Expand All @@ -65,7 +65,7 @@ public void testGroupEntity() {
}

@Test
public void testSpecialGroupEntity() {
void testSpecialGroupEntity() {
Group entity = Group.ofAllAuthenticatedUsers();
assertEquals("allAuthenticatedUsers", entity.getIdentifier());
Dataset.Access pb = entity.toPb();
Expand All @@ -85,7 +85,7 @@ public void testSpecialGroupEntity() {
}

@Test
public void testUserEntity() {
void testUserEntity() {
User entity = new User("u1");
assertEquals("u1", entity.getEmail());
assertEquals(Type.USER, entity.getType());
Expand All @@ -94,7 +94,7 @@ public void testUserEntity() {
}

@Test
public void testViewEntity() {
void testViewEntity() {
TableId viewId = TableId.of("project", "dataset", "view");
View entity = new View(viewId);
assertEquals(viewId, entity.getId());
Expand All @@ -104,7 +104,7 @@ public void testViewEntity() {
}

@Test
public void testRoutineEntity() {
void testRoutineEntity() {
RoutineId routineId = RoutineId.of("project", "dataset", "routine");
Acl.Routine entity = new Acl.Routine(routineId);
assertEquals(routineId, entity.getId());
Expand All @@ -114,15 +114,15 @@ public void testRoutineEntity() {
}

@Test
public void testIamMemberEntity() {
void testIamMemberEntity() {
IamMember entity = new IamMember("member1");
assertEquals("member1", entity.getIamMember());
Dataset.Access pb = entity.toPb();
assertEquals(entity, Entity.fromPb(pb));
}

@Test
public void testOf() {
void testOf() {
Acl acl = Acl.of(Group.ofAllAuthenticatedUsers(), Role.READER);
assertEquals(Group.ofAllAuthenticatedUsers(), acl.getEntity());
assertEquals(Role.READER, acl.getRole());
Expand All @@ -139,7 +139,7 @@ public void testOf() {
}

@Test
public void testOfWithCondition() {
void testOfWithCondition() {
Expr expr = new Expr("expression", "title", "description", "location");
Acl acl = Acl.of(Group.ofAllAuthenticatedUsers(), Role.READER, expr);
Dataset.Access pb = acl.toPb();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
package com.google.cloud.bigquery;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.google.api.client.util.Data;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class AnnotationsTest {
@Test
public void testFromUser() {
void testFromUser() {
assertThat(Annotations.fromUser(null).userMap()).isNull();

HashMap<String, String> user = new HashMap<>();
Expand All @@ -43,7 +43,7 @@ public void testFromUser() {
}

@Test
public void testFromToPb() {
void testFromToPb() {
assertThat(Annotations.fromPb(null).toPb()).isNull();

HashMap<String, String> pb = new HashMap<>();
Expand All @@ -60,17 +60,13 @@ public void testFromToPb() {
}

@Test
public void testNullKey() {
try {
Annotations.fromUser(Collections.singletonMap((String) null, "foo"));
fail("null key shouldn't work");
} catch (IllegalArgumentException e) {
}
void testNullKey() {
assertThrows(
IllegalArgumentException.class,
() -> Annotations.fromUser(Collections.singletonMap((String) null, "foo")));

try {
Annotations.fromPb(Collections.singletonMap((String) null, "foo"));
fail("null key shouldn't work");
} catch (IllegalArgumentException e) {
}
assertThrows(
IllegalArgumentException.class,
() -> Annotations.fromPb(Collections.singletonMap((String) null, "foo")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class AvroOptionsTest {

Expand All @@ -27,7 +27,7 @@ public class AvroOptionsTest {
AvroOptions.newBuilder().setUseAvroLogicalTypes(USE_AVRO_LOGICAL_TYPES).build();

@Test
public void testToBuilder() {
void testToBuilder() {
compareAvroOptions(AVRO_OPTIONS, AVRO_OPTIONS.toBuilder().build());
AvroOptions avroOptions = AVRO_OPTIONS.toBuilder().setUseAvroLogicalTypes(false).build();
assertEquals(false, avroOptions.useAvroLogicalTypes());
Expand All @@ -36,13 +36,13 @@ public void testToBuilder() {
}

@Test
public void testBuilder() {
void testBuilder() {
assertEquals(FormatOptions.AVRO, AVRO_OPTIONS.getType());
assertEquals(USE_AVRO_LOGICAL_TYPES, AVRO_OPTIONS.useAvroLogicalTypes());
}

@Test
public void testToAndFromPb() {
void testToAndFromPb() {
compareAvroOptions(AVRO_OPTIONS, AvroOptions.fromPb(AVRO_OPTIONS.toPb()));
AvroOptions avroOptions =
AvroOptions.newBuilder().setUseAvroLogicalTypes(USE_AVRO_LOGICAL_TYPES).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BigLakeConfigurationTest {
class BigLakeConfigurationTest {

private static final String STORAGE_URI = "gs://storage-uri";
private static final String FILE_FORMAT = "PARQUET";
Expand All @@ -43,20 +43,20 @@ public class BigLakeConfigurationTest {
.setConnectionId(CONNECTION_ID);

@Test
public void testToBuilder() {
void testToBuilder() {
assertEquals(STORAGE_URI, BIG_LAKE_CONFIGURATION.getStorageUri());
assertEquals(FILE_FORMAT, BIG_LAKE_CONFIGURATION.getFileFormat());
assertEquals(TABLE_FORMAT, BIG_LAKE_CONFIGURATION.getTableFormat());
assertEquals(CONNECTION_ID, BIG_LAKE_CONFIGURATION.getConnectionId());
}

@Test
public void testToPb() {
void testToPb() {
assertBigLakeConfiguration(BIG_LAKE_CONFIGURATION_PB, BIG_LAKE_CONFIGURATION.toPb());
}

@Test
public void testFromPb() {
void testFromPb() {
assertBigLakeConfiguration(
BIG_LAKE_CONFIGURATION, BigLakeConfiguration.fromPb(BIG_LAKE_CONFIGURATION_PB));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BigQueryErrorTest {

Expand All @@ -32,7 +32,7 @@ public class BigQueryErrorTest {
new BigQueryError(REASON, LOCATION, MESSAGE);

@Test
public void testConstructor() {
void testConstructor() {
assertEquals(REASON, ERROR.getReason());
assertEquals(LOCATION, ERROR.getLocation());
assertEquals(DEBUG_INFO, ERROR.getDebugInfo());
Expand All @@ -44,7 +44,7 @@ public void testConstructor() {
}

@Test
public void testToAndFromPb() {
void testToAndFromPb() {
compareBigQueryError(ERROR, BigQueryError.fromPb(ERROR.toPb()));
compareBigQueryError(ERROR_INCOMPLETE, BigQueryError.fromPb(ERROR_INCOMPLETE.toPb()));
}
Expand Down
Loading
Loading