Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 12 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

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 {
private static List<com.google.api.services.bigquery.model.TableMetadataCacheUsage>
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,7 +31,7 @@
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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
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.fail;

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
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 AvroOptionsTest {

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 BigLakeConfigurationTest {

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 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.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
Expand All @@ -40,11 +40,11 @@
import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class BigQueryExceptionTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
import static com.google.cloud.bigquery.BigQuery.JobField.USER_EMAIL;
import static com.google.cloud.bigquery.BigQueryImpl.optionMap;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.*;

import com.google.api.gax.paging.Page;
Expand All @@ -47,16 +54,19 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
public class BigQueryImplTest {

private static final String PROJECT = "project";
Expand Down Expand Up @@ -537,7 +547,7 @@ private BigQueryOptions createBigQueryOptionsForProjectWithLocation(
.build();
}

@Before
@BeforeEach
public void setUp() {
rpcFactoryMock = mock(BigQueryRpcFactory.class);
bigqueryRpcMock = mock(HttpBigQueryRpc.class);
Expand Down Expand Up @@ -631,9 +641,9 @@ public void testGetDatasetNotFoundWhenThrowIsEnabled() throws IOException {
bigquery = options.getService();
try {
bigquery.getDataset("dataset-not-found");
Assert.fail();
Assertions.fail();
} catch (BigQueryException ex) {
Assert.assertNotNull(ex.getMessage());
Assertions.assertNotNull(ex.getMessage());
}
verify(bigqueryRpcMock)
.getDatasetSkipExceptionTranslation(PROJECT, "dataset-not-found", EMPTY_RPC_OPTIONS);
Expand Down Expand Up @@ -979,9 +989,9 @@ public void testGetTableNotFoundWhenThrowIsEnabled() throws IOException {
bigquery = options.getService();
try {
bigquery.getTable(DATASET, "table-not-found");
Assert.fail();
Assertions.fail();
} catch (BigQueryException ex) {
Assert.assertNotNull(ex.getMessage());
Assertions.assertNotNull(ex.getMessage());
}
verify(bigqueryRpcMock)
.getTableSkipExceptionTranslation(PROJECT, DATASET, "table-not-found", EMPTY_RPC_OPTIONS);
Expand Down Expand Up @@ -1468,9 +1478,9 @@ public TableDataInsertAllRequest.Rows apply(RowToInsert rowToInsert) {
.getService();
try {
bigquery.insertAll(request);
Assert.fail();
Assertions.fail();
} catch (BigQueryException ex) {
Assert.assertNotNull(ex.getMessage());
Assertions.assertNotNull(ex.getMessage());
}
verify(bigqueryRpcMock).insertAll(PROJECT, DATASET, TABLE, requestPb);
}
Expand Down Expand Up @@ -2055,9 +2065,9 @@ public void testGetJobNotFoundWhenThrowIsEnabled() throws IOException {
bigquery = options.getService();
try {
bigquery.getJob("job-not-found");
Assert.fail();
Assertions.fail();
} catch (BigQueryException ex) {
Assert.assertNotNull(ex.getMessage());
Assertions.assertNotNull(ex.getMessage());
}
verify(bigqueryRpcMock)
.getJobSkipExceptionTranslation(PROJECT, "job-not-found", null, EMPTY_RPC_OPTIONS);
Expand Down Expand Up @@ -2783,9 +2793,9 @@ public void testNonRetryableException() throws IOException {
.getService();
try {
bigquery.getDataset(DatasetId.of(DATASET));
Assert.fail();
Assertions.fail();
} catch (BigQueryException ex) {
Assert.assertEquals(exceptionMessage, ex.getMessage());
assertEquals(exceptionMessage, ex.getMessage());
}
verify(bigqueryRpcMock).getDatasetSkipExceptionTranslation(PROJECT, DATASET, EMPTY_RPC_OPTIONS);
}
Expand All @@ -2802,9 +2812,9 @@ public void testRuntimeException() throws IOException {
.getService();
try {
bigquery.getDataset(DATASET);
Assert.fail();
Assertions.fail();
} catch (BigQueryException ex) {
Assert.assertTrue(ex.getMessage().endsWith(exceptionMessage));
assertTrue(ex.getMessage().endsWith(exceptionMessage));
}
verify(bigqueryRpcMock).getDatasetSkipExceptionTranslation(PROJECT, DATASET, EMPTY_RPC_OPTIONS);
}
Expand All @@ -2818,9 +2828,9 @@ public void testQueryDryRun() throws Exception {
.build()
.getService()
.query(QueryJobConfiguration.newBuilder("foo").setDryRun(true).build());
Assert.fail();
Assertions.fail();
} catch (UnsupportedOperationException ex) {
Assert.assertNotNull(ex.getMessage());
Assertions.assertNotNull(ex.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@

package com.google.cloud.bigquery;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.google.cloud.TransportOptions;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class BigQueryOptionsTest {

@Test
public void testInvalidTransport() {
try {
BigQueryOptions.newBuilder().setTransportOptions(Mockito.mock(TransportOptions.class));
Assert.fail();
Assertions.fail();
} catch (IllegalArgumentException expected) {
Assert.assertNotNull(expected.getMessage());
Assertions.assertNotNull(expected.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import org.apache.arrow.vector.util.Text;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BigQueryResultImplTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import static com.google.common.truth.Truth.assertThat;

import com.google.common.collect.ImmutableList;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class BigtableOptionsTest {

Expand Down Expand Up @@ -83,31 +83,31 @@ public void testConstructors() {
public void testNullPointerException() {
try {
BigtableColumnFamily.newBuilder().setFamilyID(null).build();
Assert.fail();
Assertions.fail();
} catch (NullPointerException ex) {
assertThat(ex.getMessage()).isNotNull();
}
try {
BigtableColumnFamily.newBuilder().setColumns(null).build();
Assert.fail();
Assertions.fail();
} catch (NullPointerException ex) {
assertThat(ex.getMessage()).isNotNull();
}
try {
BigtableColumnFamily.newBuilder().setEncoding(null).build();
Assert.fail();
Assertions.fail();
} catch (NullPointerException ex) {
assertThat(ex.getMessage()).isNotNull();
}
try {
BigtableColumnFamily.newBuilder().setOnlyReadLatest(null).build();
Assert.fail();
Assertions.fail();
} catch (NullPointerException ex) {
assertThat(ex.getMessage()).isNotNull();
}
try {
BigtableColumnFamily.newBuilder().setType(null).build();
Assert.fail();
Assertions.fail();
} catch (NullPointerException ex) {
assertThat(ex.getMessage()).isNotNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

package com.google.cloud.bigquery;

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

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

public class CloneDefinitionTest {
private static final TableId BASE_TABLE_ID = TableId.of("DATASET_NAME", "BASE_TABLE_NAME");
Expand Down
Loading
Loading