From b4b108270a5c0be299ef098e9b2fb9d36989832c Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 12 Jan 2026 20:53:15 -0500 Subject: [PATCH 1/7] test: Migrate tests to JUnit5 --- datastore-v1-proto-client/pom.xml | 14 +- .../ChecksumEnforcingInputStreamTest.java | 65 ++-- .../v1/client/DatastoreClientTest.java | 129 +++---- .../v1/client/DatastoreEmulatorTest.java | 41 +-- .../v1/client/DatastoreFactoryTest.java | 23 +- .../v1/client/DatastoreHelperTest.java | 83 ++--- .../client/EndToEndChecksumHandlerTest.java | 35 +- .../v1/client/QuerySplitterTest.java | 29 +- .../datastore/v1/client/RemoteRpcTest.java | 31 +- .../client/it/ITDatastoreProtoClientTest.java | 14 +- google-cloud-datastore-utils/pom.xml | 14 +- .../datastore/utils/DatastoreClientTest.java | 122 +++---- .../datastore/utils/DatastoreFactoryTest.java | 23 +- .../datastore/utils/DatastoreHelperTest.java | 95 ++--- .../datastore/utils/QuerySplitterTest.java | 29 +- .../google/datastore/utils/RemoteRpcTest.java | 26 +- .../utils/it/ITDatastoreProtoClientTest.java | 14 +- google-cloud-datastore/pom.xml | 19 +- .../admin/v1/DatastoreAdminClient.java | 2 +- .../admin/v1/DatastoreAdminSettings.java | 2 +- .../datastore/admin/v1/package-info.java | 2 +- .../admin/v1/stub/DatastoreAdminStub.java | 2 +- .../v1/stub/DatastoreAdminStubSettings.java | 2 +- .../GrpcDatastoreAdminCallableFactory.java | 2 +- .../admin/v1/stub/GrpcDatastoreAdminStub.java | 2 +- ...HttpJsonDatastoreAdminCallableFactory.java | 2 +- .../v1/stub/HttpJsonDatastoreAdminStub.java | 2 +- .../cloud/datastore/v1/DatastoreClient.java | 2 +- .../cloud/datastore/v1/DatastoreSettings.java | 2 +- .../cloud/datastore/v1/package-info.java | 2 +- .../datastore/v1/stub/DatastoreStub.java | 2 +- .../v1/stub/DatastoreStubSettings.java | 2 +- .../v1/stub/GrpcDatastoreCallableFactory.java | 2 +- .../datastore/v1/stub/GrpcDatastoreStub.java | 2 +- .../HttpJsonDatastoreCallableFactory.java | 2 +- .../v1/stub/HttpJsonDatastoreStub.java | 2 +- .../datastore/AbstractDatastoreTest.java | 335 +++++++----------- .../cloud/datastore/AggregationQueryTest.java | 40 +-- .../datastore/AggregationResultTest.java | 20 +- .../BaseDatastoreBatchWriterTest.java | 163 +++++---- .../cloud/datastore/BaseEntityTest.java | 71 ++-- .../google/cloud/datastore/BaseKeyTest.java | 69 ++-- .../com/google/cloud/datastore/BlobTest.java | 32 +- .../google/cloud/datastore/BlobValueTest.java | 16 +- .../cloud/datastore/BooleanValueTest.java | 16 +- .../google/cloud/datastore/CursorTest.java | 18 +- .../datastore/DatastoreExceptionTest.java | 35 +- .../cloud/datastore/DatastoreHelperTest.java | 22 +- .../cloud/datastore/DatastoreOptionsTest.java | 47 ++- .../cloud/datastore/DatastoreTestGrpc.java | 27 +- .../cloud/datastore/DatastoreTestHttp.java | 23 +- .../cloud/datastore/DatastoreUtilsTest.java | 8 +- .../cloud/datastore/DoubleValueTest.java | 16 +- .../google/cloud/datastore/EntityTest.java | 18 +- .../cloud/datastore/EntityValueTest.java | 16 +- .../cloud/datastore/FullEntityTest.java | 18 +- .../datastore/GqlQueryProtoPreparerTest.java | 16 +- .../GrpcToDatastoreCodeTranslationTest.java | 6 +- .../cloud/datastore/IncompleteKeyTest.java | 20 +- .../cloud/datastore/KeyFactoryTest.java | 47 ++- .../com/google/cloud/datastore/KeyTest.java | 24 +- .../google/cloud/datastore/KeyValueTest.java | 16 +- .../google/cloud/datastore/LatLngTest.java | 66 ++-- .../cloud/datastore/LatLngValueTest.java | 16 +- .../google/cloud/datastore/ListValueTest.java | 16 +- .../google/cloud/datastore/LongValueTest.java | 16 +- .../google/cloud/datastore/NullValueTest.java | 18 +- .../cloud/datastore/PathElementTest.java | 24 +- .../cloud/datastore/ProjectionEntityTest.java | 22 +- .../google/cloud/datastore/RawValueTest.java | 16 +- .../ReadOptionProtoPreparerTest.java | 20 +- .../cloud/datastore/SerializationTest.java | 2 +- .../cloud/datastore/StringValueTest.java | 16 +- .../StructuredQueryProtoPreparerTest.java | 22 +- .../cloud/datastore/StructuredQueryTest.java | 24 +- .../cloud/datastore/TimestampValueTest.java | 16 +- .../TransactionExceptionHandlerTest.java | 10 +- .../com/google/cloud/datastore/ValueTest.java | 28 +- .../v1/DatastoreAdminClientHttpJsonTest.java | 2 +- .../admin/v1/DatastoreAdminClientTest.java | 2 +- .../admin/v1/MockDatastoreAdmin.java | 2 +- .../admin/v1/MockDatastoreAdminImpl.java | 2 +- .../aggregation/AvgAggregationTest.java | 16 +- .../aggregation/CountAggregationTest.java | 10 +- .../aggregation/SumAggregationTest.java | 16 +- .../AggregationQueryExecutorTest.java | 15 +- ...regationQueryRequestProtoPreparerTest.java | 16 +- ...gregationQueryResponseTransformerTest.java | 10 +- .../datastore/it/AbstractITDatastoreTest.java | 135 ++++--- .../datastore/it/ITDatastoreConceptsTest.java | 156 ++++---- .../datastore/it/ITDatastoreTestGrpc.java | 34 +- .../datastore/it/ITDatastoreTestHttp.java | 32 +- .../cloud/datastore/it/ITE2ETracingTest.java | 83 ++--- .../cloud/datastore/it/ITTracingTest.java | 60 ++-- .../datastore/it/MultipleAttemptsRule.java | 71 ---- .../it/MultipleAttemptsRuleTest.java | 31 +- .../datastore/models/ExecutionStatsTest.java | 8 +- .../datastore/models/ExplainOptionsTest.java | 8 +- .../datastore/models/PlanSummaryTest.java | 8 +- .../cloud/datastore/spi/v1/RpcUtilsTest.java | 6 +- .../telemetry/DisabledTraceUtilTest.java | 12 +- .../telemetry/EnabledTraceUtilTest.java | 26 +- .../datastore/telemetry/TraceUtilTest.java | 10 +- .../testing/ITLocalDatastoreHelperTest.java | 110 +++--- .../v1/DatastoreClientHttpJsonTest.java | 2 +- .../datastore/v1/DatastoreClientTest.java | 2 +- .../cloud/datastore/v1/MockDatastore.java | 2 +- .../cloud/datastore/v1/MockDatastoreImpl.java | 2 +- .../admin/v1/DatastoreAdminGrpc.java | 2 +- .../google/datastore/v1/DatastoreGrpc.java | 2 +- pom.xml | 27 +- .../datastore/admin/v1/CommonMetadata.java | 2 +- .../admin/v1/CommonMetadataOrBuilder.java | 2 +- .../admin/v1/CreateIndexRequest.java | 2 +- .../admin/v1/CreateIndexRequestOrBuilder.java | 2 +- .../admin/v1/DatastoreAdminProto.java | 2 +- .../DatastoreFirestoreMigrationMetadata.java | 2 +- ...reFirestoreMigrationMetadataOrBuilder.java | 2 +- .../admin/v1/DeleteIndexRequest.java | 2 +- .../admin/v1/DeleteIndexRequestOrBuilder.java | 2 +- .../datastore/admin/v1/EntityFilter.java | 2 +- .../admin/v1/EntityFilterOrBuilder.java | 2 +- .../admin/v1/ExportEntitiesMetadata.java | 2 +- .../v1/ExportEntitiesMetadataOrBuilder.java | 2 +- .../admin/v1/ExportEntitiesRequest.java | 2 +- .../v1/ExportEntitiesRequestOrBuilder.java | 2 +- .../admin/v1/ExportEntitiesResponse.java | 2 +- .../v1/ExportEntitiesResponseOrBuilder.java | 2 +- .../datastore/admin/v1/GetIndexRequest.java | 2 +- .../admin/v1/GetIndexRequestOrBuilder.java | 2 +- .../admin/v1/ImportEntitiesMetadata.java | 2 +- .../v1/ImportEntitiesMetadataOrBuilder.java | 2 +- .../admin/v1/ImportEntitiesRequest.java | 2 +- .../v1/ImportEntitiesRequestOrBuilder.java | 2 +- .../com/google/datastore/admin/v1/Index.java | 2 +- .../admin/v1/IndexOperationMetadata.java | 2 +- .../v1/IndexOperationMetadataOrBuilder.java | 2 +- .../datastore/admin/v1/IndexOrBuilder.java | 2 +- .../google/datastore/admin/v1/IndexProto.java | 2 +- .../admin/v1/ListIndexesRequest.java | 2 +- .../admin/v1/ListIndexesRequestOrBuilder.java | 2 +- .../admin/v1/ListIndexesResponse.java | 2 +- .../v1/ListIndexesResponseOrBuilder.java | 2 +- .../admin/v1/MigrationProgressEvent.java | 2 +- .../v1/MigrationProgressEventOrBuilder.java | 2 +- .../datastore/admin/v1/MigrationProto.java | 2 +- .../datastore/admin/v1/MigrationState.java | 2 +- .../admin/v1/MigrationStateEvent.java | 2 +- .../v1/MigrationStateEventOrBuilder.java | 2 +- .../datastore/admin/v1/MigrationStep.java | 2 +- .../datastore/admin/v1/OperationType.java | 2 +- .../google/datastore/admin/v1/Progress.java | 2 +- .../datastore/admin/v1/ProgressOrBuilder.java | 2 +- .../google/datastore/v1/AggregationQuery.java | 2 +- .../v1/AggregationQueryOrBuilder.java | 2 +- .../datastore/v1/AggregationResult.java | 2 +- .../datastore/v1/AggregationResultBatch.java | 2 +- .../v1/AggregationResultBatchOrBuilder.java | 2 +- .../v1/AggregationResultOrBuilder.java | 2 +- .../datastore/v1/AggregationResultProto.java | 2 +- .../datastore/v1/AllocateIdsRequest.java | 2 +- .../v1/AllocateIdsRequestOrBuilder.java | 2 +- .../datastore/v1/AllocateIdsResponse.java | 2 +- .../v1/AllocateIdsResponseOrBuilder.java | 2 +- .../com/google/datastore/v1/ArrayValue.java | 2 +- .../datastore/v1/ArrayValueOrBuilder.java | 2 +- .../datastore/v1/BeginTransactionRequest.java | 2 +- .../v1/BeginTransactionRequestOrBuilder.java | 2 +- .../v1/BeginTransactionResponse.java | 2 +- .../v1/BeginTransactionResponseOrBuilder.java | 2 +- .../google/datastore/v1/CommitRequest.java | 2 +- .../datastore/v1/CommitRequestOrBuilder.java | 2 +- .../google/datastore/v1/CommitResponse.java | 2 +- .../datastore/v1/CommitResponseOrBuilder.java | 2 +- .../google/datastore/v1/CompositeFilter.java | 2 +- .../v1/CompositeFilterOrBuilder.java | 2 +- .../google/datastore/v1/DatastoreProto.java | 2 +- .../java/com/google/datastore/v1/Entity.java | 2 +- .../google/datastore/v1/EntityOrBuilder.java | 2 +- .../com/google/datastore/v1/EntityProto.java | 2 +- .../com/google/datastore/v1/EntityResult.java | 2 +- .../datastore/v1/EntityResultOrBuilder.java | 2 +- .../google/datastore/v1/ExecutionStats.java | 2 +- .../datastore/v1/ExecutionStatsOrBuilder.java | 2 +- .../google/datastore/v1/ExplainMetrics.java | 2 +- .../datastore/v1/ExplainMetricsOrBuilder.java | 2 +- .../google/datastore/v1/ExplainOptions.java | 2 +- .../datastore/v1/ExplainOptionsOrBuilder.java | 2 +- .../java/com/google/datastore/v1/Filter.java | 2 +- .../google/datastore/v1/FilterOrBuilder.java | 2 +- .../com/google/datastore/v1/FindNearest.java | 2 +- .../datastore/v1/FindNearestOrBuilder.java | 2 +- .../com/google/datastore/v1/GqlQuery.java | 2 +- .../datastore/v1/GqlQueryOrBuilder.java | 2 +- .../datastore/v1/GqlQueryParameter.java | 2 +- .../v1/GqlQueryParameterOrBuilder.java | 2 +- .../java/com/google/datastore/v1/Key.java | 2 +- .../com/google/datastore/v1/KeyOrBuilder.java | 2 +- .../google/datastore/v1/KindExpression.java | 2 +- .../datastore/v1/KindExpressionOrBuilder.java | 2 +- .../google/datastore/v1/LookupRequest.java | 2 +- .../datastore/v1/LookupRequestOrBuilder.java | 2 +- .../google/datastore/v1/LookupResponse.java | 2 +- .../datastore/v1/LookupResponseOrBuilder.java | 2 +- .../com/google/datastore/v1/Mutation.java | 2 +- .../datastore/v1/MutationOrBuilder.java | 2 +- .../google/datastore/v1/MutationResult.java | 2 +- .../datastore/v1/MutationResultOrBuilder.java | 2 +- .../com/google/datastore/v1/PartitionId.java | 2 +- .../datastore/v1/PartitionIdOrBuilder.java | 2 +- .../com/google/datastore/v1/PlanSummary.java | 2 +- .../datastore/v1/PlanSummaryOrBuilder.java | 2 +- .../com/google/datastore/v1/Projection.java | 2 +- .../datastore/v1/ProjectionOrBuilder.java | 2 +- .../google/datastore/v1/PropertyFilter.java | 2 +- .../datastore/v1/PropertyFilterOrBuilder.java | 2 +- .../com/google/datastore/v1/PropertyMask.java | 2 +- .../datastore/v1/PropertyMaskOrBuilder.java | 2 +- .../google/datastore/v1/PropertyOrder.java | 2 +- .../datastore/v1/PropertyOrderOrBuilder.java | 2 +- .../datastore/v1/PropertyReference.java | 2 +- .../v1/PropertyReferenceOrBuilder.java | 2 +- .../datastore/v1/PropertyTransform.java | 2 +- .../v1/PropertyTransformOrBuilder.java | 2 +- .../java/com/google/datastore/v1/Query.java | 2 +- .../google/datastore/v1/QueryOrBuilder.java | 2 +- .../datastore/v1/QueryProfileProto.java | 2 +- .../com/google/datastore/v1/QueryProto.java | 2 +- .../google/datastore/v1/QueryResultBatch.java | 2 +- .../v1/QueryResultBatchOrBuilder.java | 2 +- .../com/google/datastore/v1/ReadOptions.java | 2 +- .../datastore/v1/ReadOptionsOrBuilder.java | 2 +- .../datastore/v1/ReserveIdsRequest.java | 2 +- .../v1/ReserveIdsRequestOrBuilder.java | 2 +- .../datastore/v1/ReserveIdsResponse.java | 2 +- .../v1/ReserveIdsResponseOrBuilder.java | 2 +- .../google/datastore/v1/RollbackRequest.java | 2 +- .../v1/RollbackRequestOrBuilder.java | 2 +- .../google/datastore/v1/RollbackResponse.java | 2 +- .../v1/RollbackResponseOrBuilder.java | 2 +- .../v1/RunAggregationQueryRequest.java | 2 +- .../RunAggregationQueryRequestOrBuilder.java | 2 +- .../v1/RunAggregationQueryResponse.java | 2 +- .../RunAggregationQueryResponseOrBuilder.java | 2 +- .../google/datastore/v1/RunQueryRequest.java | 2 +- .../v1/RunQueryRequestOrBuilder.java | 2 +- .../google/datastore/v1/RunQueryResponse.java | 2 +- .../v1/RunQueryResponseOrBuilder.java | 2 +- .../datastore/v1/TransactionOptions.java | 2 +- .../v1/TransactionOptionsOrBuilder.java | 2 +- .../java/com/google/datastore/v1/Value.java | 2 +- .../google/datastore/v1/ValueOrBuilder.java | 2 +- .../datastore/ConfigureConnectionPoolIT.java | 4 +- .../example/datastore/QuickstartSampleIT.java | 8 +- .../AggregationQuerySampleTestIT.java | 38 +- .../filters/MultiIneqQuerySampleIT.java | 10 +- .../filters/OrFilterQuerySampleIT.java | 8 +- .../queryprofile/QueryProfileSampleIT.java | 14 +- .../datastore/snippets/ConceptsTest.java | 126 +++---- 259 files changed, 1742 insertions(+), 1981 deletions(-) delete mode 100644 google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRule.java diff --git a/datastore-v1-proto-client/pom.xml b/datastore-v1-proto-client/pom.xml index cadbbea61..c397dbe44 100644 --- a/datastore-v1-proto-client/pom.xml +++ b/datastore-v1-proto-client/pom.xml @@ -91,8 +91,18 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.vintage + junit-vintage-engine test diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/ChecksumEnforcingInputStreamTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/ChecksumEnforcingInputStreamTest.java index dbe0e766a..68a27f06e 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/ChecksumEnforcingInputStreamTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/ChecksumEnforcingInputStreamTest.java @@ -16,33 +16,32 @@ package com.google.datastore.v1.client; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.ByteArrayInputStream; import java.io.IOException; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Test for {@link ChecksumEnforcingInputStream}. */ -@RunWith(JUnit4.class) -public class ChecksumEnforcingInputStreamTest { - public void test(int payloadSize) throws Exception { +class ChecksumEnforcingInputStreamTest { + void test(int payloadSize) throws Exception { // read 1000 bytes at a time // Since checksum should be correct, do not expect IOException - try (ChecksumEnforcingInputStream testInstance = setUpData(payloadSize)) { - byte[] buf = new byte[1000]; - while (testInstance.read(buf, 0, 1000) != -1) { - // do nothing with the bytes read - } - } catch (IOException e) { - fail("checksum verification failed! " + e.getMessage()); - } + assertDoesNotThrow( + () -> { + try (ChecksumEnforcingInputStream testInstance = setUpData(payloadSize)) { + byte[] buf = new byte[1000]; + while (testInstance.read(buf, 0, 1000) != -1) { + // do nothing with the bytes read + } + } + }); } @Test - public void read_withValidChecksum_differentPayloadSizes() throws Exception { + void read_withValidChecksum_differentPayloadSizes() throws Exception { // test with various payload sizes (1, 2, 2**2, 2**3 etc upto 2**28 = 256MB) for (int i = 0, payloadSize = 1; i < 29; i++) { long start = System.currentTimeMillis(); @@ -57,26 +56,24 @@ public void read_withValidChecksum_differentPayloadSizes() throws Exception { } @Test - public void read_withInvalidChecksum() { - // build a test instance with invalidchecksum - // read 1000 bytes at a time - // Since checksum should be correct, do not expect IOException - try (ChecksumEnforcingInputStream instance = - new ChecksumEnforcingInputStream( - new ByteArrayInputStream("hello there".getBytes(UTF_8)), "this checksum is invalid")) { - byte[] buf = new byte[1000]; - while (instance.read(buf, 0, 1000) != -1) { - // do nothing with the bytes read - } - } catch (IOException e) { - // this is expected - return; - } - fail("should have failed"); + void read_withInvalidChecksum() { + assertThrows( + IOException.class, + () -> { + try (ChecksumEnforcingInputStream instance = + new ChecksumEnforcingInputStream( + new ByteArrayInputStream("hello there".getBytes(UTF_8)), + "this checksum is invalid")) { + byte[] buf = new byte[1000]; + while (instance.read(buf, 0, 1000) != -1) { + // do nothing with the bytes read + } + } + }); } @Test - public void markNotSupported() throws Exception { + void markNotSupported() throws Exception { try (ChecksumEnforcingInputStream testInstance = setUpData(1)) { assertFalse(testInstance.markSupported()); } diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java index 16a6303bb..bfb45c633 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java @@ -16,11 +16,10 @@ package com.google.datastore.v1.client; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; @@ -51,13 +50,10 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.SocketTimeoutException; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link DatastoreFactory} and {@link Datastore}. */ -@RunWith(JUnit4.class) -public class DatastoreClientTest { +class DatastoreClientTest { private static final String PROJECT_ID = "project-id"; private DatastoreFactory factory = new MockDatastoreFactory(); @@ -65,7 +61,7 @@ public class DatastoreClientTest { new DatastoreOptions.Builder().projectId(PROJECT_ID).credential(new MockCredential()); @Test - public void options_NoProjectIdOrProjectEndpoint() { + void options_NoProjectIdOrProjectEndpoint() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -77,7 +73,7 @@ public void options_NoProjectIdOrProjectEndpoint() { } @Test - public void options_ProjectIdAndProjectEndpoint() throws Exception { + void options_ProjectIdAndProjectEndpoint() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -92,7 +88,7 @@ public void options_ProjectIdAndProjectEndpoint() throws Exception { } @Test - public void options_LocalHostAndProjectEndpoint() throws Exception { + void options_LocalHostAndProjectEndpoint() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -107,7 +103,7 @@ public void options_LocalHostAndProjectEndpoint() throws Exception { } @Test - public void options_HostAndProjectEndpoint() throws Exception { + void options_HostAndProjectEndpoint() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -122,7 +118,7 @@ public void options_HostAndProjectEndpoint() throws Exception { } @Test - public void options_HostAndLocalHost() throws Exception { + void options_HostAndLocalHost() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -136,7 +132,7 @@ public void options_HostAndLocalHost() throws Exception { } @Test - public void options_InvalidLocalHost() throws Exception { + void options_InvalidLocalHost() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -150,7 +146,7 @@ public void options_InvalidLocalHost() throws Exception { } @Test - public void options_SchemeInLocalHost() { + void options_SchemeInLocalHost() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -161,7 +157,7 @@ public void options_SchemeInLocalHost() { } @Test - public void options_InvalidHost() { + void options_InvalidHost() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -175,7 +171,7 @@ public void options_InvalidHost() { } @Test - public void options_SchemeInHost() { + void options_SchemeInHost() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -187,12 +183,12 @@ public void options_SchemeInHost() { } @Test - public void create_NullOptions() throws Exception { + void create_NullOptions() throws Exception { assertThrows(NullPointerException.class, () -> factory.create(null)); } @Test - public void create_Host() { + void create_Host() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -204,7 +200,7 @@ public void create_Host() { } @Test - public void create_LocalHost() { + void create_LocalHost() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -216,7 +212,7 @@ public void create_LocalHost() { } @Test - public void create_LocalHostIp() { + void create_LocalHostIp() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -228,7 +224,7 @@ public void create_LocalHostIp() { } @Test - public void create_DefaultHost() { + void create_DefaultHost() { Datastore datastore = factory.create(new DatastoreOptions.Builder().projectId(PROJECT_ID).build()); assertThat(datastore.remoteRpc.getUrl()) @@ -236,7 +232,7 @@ public void create_DefaultHost() { } @Test - public void create_ProjectEndpoint() { + void create_ProjectEndpoint() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -247,7 +243,7 @@ public void create_ProjectEndpoint() { } @Test - public void create_ProjectEndpointNoScheme() { + void create_ProjectEndpointNoScheme() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -264,7 +260,7 @@ public void create_ProjectEndpointNoScheme() { } @Test - public void initializer() throws Exception { + void initializer() throws Exception { options.initializer( new HttpRequestInitializer() { @Override @@ -282,21 +278,21 @@ public void initialize(HttpRequest request) { } @Test - public void allocateIds() throws Exception { + void allocateIds() throws Exception { AllocateIdsRequest.Builder request = AllocateIdsRequest.newBuilder(); AllocateIdsResponse.Builder response = AllocateIdsResponse.newBuilder(); expectRpc("allocateIds", request.build(), response.build()); } @Test - public void lookup() throws Exception { + void lookup() throws Exception { LookupRequest.Builder request = LookupRequest.newBuilder(); LookupResponse.Builder response = LookupResponse.newBuilder(); expectRpc("lookup", request.build(), response.build()); } @Test - public void beginTransaction() throws Exception { + void beginTransaction() throws Exception { BeginTransactionRequest.Builder request = BeginTransactionRequest.newBuilder(); BeginTransactionResponse.Builder response = BeginTransactionResponse.newBuilder(); response.setTransaction(ByteString.copyFromUtf8("project-id")); @@ -304,7 +300,7 @@ public void beginTransaction() throws Exception { } @Test - public void commit() throws Exception { + void commit() throws Exception { CommitRequest.Builder request = CommitRequest.newBuilder(); request.setTransaction(ByteString.copyFromUtf8("project-id")); CommitResponse.Builder response = CommitResponse.newBuilder(); @@ -312,14 +308,14 @@ public void commit() throws Exception { } @Test - public void reserveIds() throws Exception { + void reserveIds() throws Exception { ReserveIdsRequest.Builder request = ReserveIdsRequest.newBuilder(); ReserveIdsResponse.Builder response = ReserveIdsResponse.newBuilder(); expectRpc("reserveIds", request.build(), response.build()); } @Test - public void rollback() throws Exception { + void rollback() throws Exception { RollbackRequest.Builder request = RollbackRequest.newBuilder(); request.setTransaction(ByteString.copyFromUtf8("project-id")); RollbackResponse.Builder response = RollbackResponse.newBuilder(); @@ -327,7 +323,7 @@ public void rollback() throws Exception { } @Test - public void runQuery() throws Exception { + void runQuery() throws Exception { RunQueryRequest.Builder request = RunQueryRequest.newBuilder(); request.getQueryBuilder(); RunQueryResponse.Builder response = RunQueryResponse.newBuilder(); @@ -339,7 +335,7 @@ public void runQuery() throws Exception { } @Test - public void runAggregationQuery() throws Exception { + void runAggregationQuery() throws Exception { RunAggregationQueryRequest.Builder request = RunAggregationQueryRequest.newBuilder(); RunAggregationQueryResponse.Builder response = RunAggregationQueryResponse.newBuilder(); expectRpc("runAggregationQuery", request.build(), response.build()); @@ -366,41 +362,46 @@ private void expectRpc(String methodName, Message request, Message response) thr assertEquals(0, datastore.getRpcCount()); mockClient.setNextError(400, Code.INVALID_ARGUMENT, "oops"); - try { - call.invoke(datastore, callArgs); - fail(); - } catch (InvocationTargetException targetException) { - DatastoreException exception = (DatastoreException) targetException.getCause(); - assertEquals(Code.INVALID_ARGUMENT, exception.getCode()); - assertEquals(methodName, exception.getMethodName()); - assertEquals("oops", exception.getMessage()); - } + InvocationTargetException ex1 = + assertThrows(InvocationTargetException.class, () -> call.invoke(datastore, callArgs)); + DatastoreException exception = (DatastoreException) ex1.getCause(); + assertEquals(Code.INVALID_ARGUMENT, exception.getCode()); + assertEquals(methodName, exception.getMethodName()); + assertEquals("oops", exception.getMessage()); SocketTimeoutException socketTimeoutException = new SocketTimeoutException("ste"); mockClient.setNextException(socketTimeoutException); - try { - call.invoke(datastore, callArgs); - fail(); - } catch (InvocationTargetException targetException) { - DatastoreException exception = (DatastoreException) targetException.getCause(); - assertEquals(Code.DEADLINE_EXCEEDED, exception.getCode()); - assertEquals(methodName, exception.getMethodName()); - assertEquals("Deadline exceeded", exception.getMessage()); - assertSame(socketTimeoutException, exception.getCause()); - } + DatastoreException exception1 = + assertThrows( + DatastoreException.class, + () -> { + try { + call.invoke(datastore, callArgs); + } catch (InvocationTargetException e) { + throw (Exception) e.getCause(); + } + }); + assertEquals(Code.DEADLINE_EXCEEDED, exception1.getCode()); + assertEquals(methodName, exception1.getMethodName()); + assertEquals("Deadline exceeded", exception1.getMessage()); + assertSame(socketTimeoutException, exception1.getCause()); IOException ioException = new IOException("ioe"); mockClient.setNextException(ioException); - try { - call.invoke(datastore, callArgs); - fail(); - } catch (InvocationTargetException targetException) { - DatastoreException exception = (DatastoreException) targetException.getCause(); - assertEquals(Code.UNAVAILABLE, exception.getCode()); - assertEquals(methodName, exception.getMethodName()); - assertEquals("I/O error", exception.getMessage()); - assertSame(ioException, exception.getCause()); - } + DatastoreException exception2 = + assertThrows( + DatastoreException.class, + () -> { + try { + call.invoke(datastore, callArgs); + } catch (InvocationTargetException e) { + throw (Exception) e.getCause(); + } + }); + assertEquals(Code.UNAVAILABLE, exception2.getCode()); + assertEquals(methodName, exception2.getMethodName()); + assertEquals("I/O error", exception2.getMessage()); + assertSame(ioException, exception2.getCause()); assertEquals(3, datastore.getRpcCount()); } diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreEmulatorTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreEmulatorTest.java index f195e61c4..60f52a07a 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreEmulatorTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreEmulatorTest.java @@ -15,22 +15,19 @@ */ package com.google.datastore.v1.client; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link DatastoreEmulator}. */ -@RunWith(JUnit4.class) -public class DatastoreEmulatorTest { +class DatastoreEmulatorTest { private static final DatastoreEmulatorOptions options = new DatastoreEmulatorOptions.Builder().build(); @Test - public void testArgs() throws DatastoreEmulatorException { + void testArgs() throws DatastoreEmulatorException { DatastoreEmulator datastore = new DatastoreEmulator(null, "blar", options) { @Override @@ -40,25 +37,15 @@ void startEmulatorInternal( } }; - try { - datastore.start(null, "projectId"); - fail("expected exception"); - } catch (NullPointerException npe) { - // good - } + assertThrows(NullPointerException.class, () -> datastore.start(null, "projectId")); - try { - datastore.start("path/to/emulator", null); - fail("expected exception"); - } catch (NullPointerException npe) { - // good - } + assertThrows(NullPointerException.class, () -> datastore.start("path/to/emulator", null)); datastore.start("path/to/emulator", "projectId"); } @Test - public void testLifecycle() throws DatastoreEmulatorException { + void testLifecycle() throws DatastoreEmulatorException { DatastoreEmulator datastore = new DatastoreEmulator(null, "blar", options) { @Override @@ -77,23 +64,13 @@ protected void stopEmulatorInternal() { String myProject = "myproject"; datastore.start(emulatorDir, myProject); - try { - datastore.start(emulatorDir, myProject); - fail("expected exception"); - } catch (IllegalStateException e) { - // good - } + assertThrows(IllegalStateException.class, () -> datastore.start(emulatorDir, myProject)); datastore.stop(); // It's ok to stop if we've already stopped. datastore.stop(); // Once we've stopped we can't start again. - try { - datastore.start(emulatorDir, myProject); - fail("expected exception"); - } catch (IllegalStateException e) { - // good - } + assertThrows(IllegalStateException.class, () -> datastore.start(emulatorDir, myProject)); } } diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreFactoryTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreFactoryTest.java index 02bb44a52..679e97eeb 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreFactoryTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreFactoryTest.java @@ -15,21 +15,18 @@ */ package com.google.datastore.v1.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.javanet.NetHttpTransport; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Test for {@link DatastoreFactory}. */ -@RunWith(JUnit4.class) -public class DatastoreFactoryTest { +class DatastoreFactoryTest { private static final String PROJECT_ID = "project-id"; private DatastoreFactory factory = DatastoreFactory.get(); @@ -39,7 +36,7 @@ public class DatastoreFactoryTest { * its own. */ @Test - public void makeClient_Default() { + void makeClient_Default() { DatastoreOptions options = new DatastoreOptions.Builder().projectId(PROJECT_ID).build(); HttpRequestFactory f = factory.makeClient(options); assertNotNull(f.getTransport()); @@ -51,7 +48,7 @@ public void makeClient_Default() { * credential. */ @Test - public void makeClient_WithCredential() { + void makeClient_WithCredential() { NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = new GoogleCredential.Builder().setTransport(transport).build(); DatastoreOptions options = @@ -62,7 +59,7 @@ public void makeClient_WithCredential() { /** Specifying a transport, but not a credential, the factory will use the transport specified. */ @Test - public void makeClient_WithTransport() { + void makeClient_WithTransport() { NetHttpTransport transport = new NetHttpTransport(); DatastoreOptions options = new DatastoreOptions.Builder().projectId(PROJECT_ID).transport(transport).build(); @@ -75,7 +72,7 @@ public void makeClient_WithTransport() { * the one in the credential. */ @Test - public void makeClient_WithCredentialTransport() { + void makeClient_WithCredentialTransport() { NetHttpTransport credTransport = new NetHttpTransport(); NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreHelperTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreHelperTest.java index 20325a4f0..2f5a9838f 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreHelperTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreHelperTest.java @@ -19,8 +19,9 @@ import static com.google.datastore.v1.client.DatastoreHelper.makeKey; import static com.google.datastore.v1.client.DatastoreHelper.makeValue; import static com.google.datastore.v1.client.DatastoreHelper.toDate; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; import com.google.datastore.v1.Key; import com.google.datastore.v1.PartitionId; @@ -29,13 +30,10 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Timestamp; import java.util.Date; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link DatastoreHelper}. */ -@RunWith(JUnit4.class) -public class DatastoreHelperTest { +class DatastoreHelperTest { private static final Key PARENT = Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Parent").setId(23L)).build(); @@ -47,65 +45,58 @@ public class DatastoreHelperTest { Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Child").setId(26L)).build(); @Test - public void testMakeKey_BadTypeForKind() { - try { - DatastoreHelper.makeKey(new Object()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + void testMakeKey_BadTypeForKind() { + assertThrows(IllegalArgumentException.class, () -> DatastoreHelper.makeKey(new Object())); } @Test - public void testMakeKey_BadTypeForNameId() { - try { - DatastoreHelper.makeKey("kind", new Object()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + void testMakeKey_BadTypeForNameId() { + assertThrows( + IllegalArgumentException.class, () -> DatastoreHelper.makeKey("kind", new Object())); } @Test - public void testMakeKey_Empty() { + void testMakeKey_Empty() { assertEquals(Key.newBuilder().build(), DatastoreHelper.makeKey().build()); } @Test - public void testMakeKey_Incomplete() { + void testMakeKey_Incomplete() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo")).build(), makeKey("Foo").build()); } @Test - public void testMakeKey_IdInt() { + void testMakeKey_IdInt() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)).build(), makeKey("Foo", 1).build()); } @Test - public void testMakeKey_IdLong() { + void testMakeKey_IdLong() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)).build(), makeKey("Foo", 1L).build()); } @Test - public void testMakeKey_IdShort() { + void testMakeKey_IdShort() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)).build(), makeKey("Foo", (short) 1).build()); } @Test - public void testMakeKey_Name() { + void testMakeKey_Name() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setName("hi")).build(), makeKey("Foo", "hi").build()); } @Test - public void testMakeKey_KindNameKind() { + void testMakeKey_KindNameKind() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setName("hi")) @@ -115,7 +106,7 @@ public void testMakeKey_KindNameKind() { } @Test - public void testMakeKey_KeyKind() { + void testMakeKey_KeyKind() { // 1 key at the beginning of the series assertEquals( Key.newBuilder() @@ -126,7 +117,7 @@ public void testMakeKey_KeyKind() { } @Test - public void testMakeKey_KindIdKeyKind() { + void testMakeKey_KindIdKeyKind() { // 1 key in the middle of the series assertEquals( Key.newBuilder() @@ -138,7 +129,7 @@ public void testMakeKey_KindIdKeyKind() { } @Test - public void testMakeKey_KindIdKey() { + void testMakeKey_KindIdKey() { // 1 key at the end of the series assertEquals( Key.newBuilder() @@ -149,7 +140,7 @@ public void testMakeKey_KindIdKey() { } @Test - public void testMakeKey_KeyKindIdKey() { + void testMakeKey_KeyKindIdKey() { // 1 key at the beginning and 1 key at the end of the series assertEquals( Key.newBuilder() @@ -161,13 +152,13 @@ public void testMakeKey_KeyKindIdKey() { } @Test - public void testMakeKey_Key() { + void testMakeKey_Key() { // Just 1 key assertEquals(Key.newBuilder().addPath(CHILD.getPath(0)).build(), makeKey(CHILD).build()); } @Test - public void testMakeKey_KeyKey() { + void testMakeKey_KeyKey() { // Just 2 keys assertEquals( Key.newBuilder().addPath(PARENT.getPath(0)).addPath(CHILD.getPath(0)).build(), @@ -175,7 +166,7 @@ public void testMakeKey_KeyKey() { } @Test - public void testMakeKey_KeyKeyKey() { + void testMakeKey_KeyKeyKey() { // Just 3 keys assertEquals( Key.newBuilder() @@ -187,7 +178,7 @@ public void testMakeKey_KeyKeyKey() { } @Test - public void testMakeKey_KeyMultiLevelKey() { + void testMakeKey_KeyMultiLevelKey() { // 1 key with 2 elements assertEquals( Key.newBuilder() @@ -199,7 +190,7 @@ public void testMakeKey_KeyMultiLevelKey() { } @Test - public void testMakeKey_MultiLevelKeyKey() { + void testMakeKey_MultiLevelKeyKey() { // 1 key with 2 elements assertEquals( Key.newBuilder() @@ -211,7 +202,7 @@ public void testMakeKey_MultiLevelKeyKey() { } @Test - public void testMakeKey_MultiLevelKey() { + void testMakeKey_MultiLevelKey() { // 1 key with 3 elements assertEquals( Key.newBuilder() @@ -223,7 +214,7 @@ public void testMakeKey_MultiLevelKey() { } @Test - public void testMakeKey_PartitionId() { + void testMakeKey_PartitionId() { PartitionId partitionId = PartitionId.newBuilder().setNamespaceId("namespace-id").build(); Key parent = PARENT.toBuilder().setPartitionId(partitionId).build(); assertEquals( @@ -236,7 +227,7 @@ public void testMakeKey_PartitionId() { } @Test - public void testMakeKey_NonMatchingPartitionId2() { + void testMakeKey_NonMatchingPartitionId2() { PartitionId partitionId1 = PartitionId.newBuilder().setNamespaceId("namespace-id").build(); PartitionId partitionId2 = PartitionId.newBuilder().setNamespaceId("another-namespace-id").build(); @@ -250,7 +241,7 @@ public void testMakeKey_NonMatchingPartitionId2() { } @Test - public void testMakeTimestampValue() throws Exception { + void testMakeTimestampValue() throws Exception { // Test cases with nanos == 0. assertConversion(-50_000, -50, 0); assertConversion(-1_000, -1, 0); @@ -301,20 +292,12 @@ private void assertTimestampToMilliseconds(long millis, long seconds, int nanos) } @Test - public void testProjectionHandling() { + void testProjectionHandling() { assertEquals( ByteString.copyFromUtf8("hi"), getByteString(makeValue("hi").setMeaning(18).build())); - try { - getByteString(makeValue("hi").build()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + assertThrows(IllegalArgumentException.class, () -> getByteString(makeValue("hi").build())); assertEquals(new Date(1), toDate(makeValue(1000).setMeaning(18).build())); - try { - toDate(makeValue(1000).build()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + assertThrows(IllegalArgumentException.class, () -> toDate(makeValue(1000).build())); } } diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/EndToEndChecksumHandlerTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/EndToEndChecksumHandlerTest.java index 1fdc1906a..fa308cec1 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/EndToEndChecksumHandlerTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/EndToEndChecksumHandlerTest.java @@ -16,68 +16,65 @@ package com.google.datastore.v1.client; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -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.assertTrue; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Test for {@link EndToEndChecksumHandler}. */ -@RunWith(JUnit4.class) -public class EndToEndChecksumHandlerTest { +class EndToEndChecksumHandlerTest { private final byte[] payloadBytes = "This is a long string with numbers 1234, 134.56 ".getBytes(UTF_8); private final byte[] payloadForUnsignedLongChecksum = "aaa".getBytes(UTF_8); private final String unsignedLongChecksum = "3818383321"; @Test - public void validateChecksum_correctChecksum() { + void validateChecksum_correctChecksum() { String computed = EndToEndChecksumHandler.computeChecksum(payloadBytes); assertTrue(EndToEndChecksumHandler.validateChecksum(computed, payloadBytes)); } @Test - public void computeChecksum_returnsUnsignedLongAsStringValue() { + void computeChecksum_returnsUnsignedLongAsStringValue() { String computed = EndToEndChecksumHandler.computeChecksum(payloadForUnsignedLongChecksum); - assertEquals("computeChecksum return value", unsignedLongChecksum, computed); + assertEquals(unsignedLongChecksum, computed, "computeChecksum return value"); } @Test - public void validateChecksum_incorrectChecksum() { + void validateChecksum_incorrectChecksum() { String computed = EndToEndChecksumHandler.computeChecksum("random string".getBytes(UTF_8)); assertFalse(EndToEndChecksumHandler.validateChecksum(computed, payloadBytes)); } @Test - public void validateChecksum_nullChecksum() { + void validateChecksum_nullChecksum() { assertFalse(EndToEndChecksumHandler.validateChecksum(null, payloadBytes)); } @Test - public void validateChecksum_emptyChecksum() { + void validateChecksum_emptyChecksum() { assertFalse(EndToEndChecksumHandler.validateChecksum("", payloadBytes)); } @Test - public void validateChecksum_nullPayload() { + void validateChecksum_nullPayload() { assertFalse(EndToEndChecksumHandler.validateChecksum("foo", null)); } @Test - public void validateChecksum_emptyPayload() { + void validateChecksum_emptyPayload() { assertFalse(EndToEndChecksumHandler.validateChecksum("foo", new byte[0])); } @Test - public void computeChecksum_nullInputBytes() { + void computeChecksum_nullInputBytes() { assertNull(EndToEndChecksumHandler.computeChecksum(null)); } @Test - public void computeChecksum_emptyArrayForInputBytes() { + void computeChecksum_emptyArrayForInputBytes() { assertNull(EndToEndChecksumHandler.computeChecksum(new byte[0])); } } diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/QuerySplitterTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/QuerySplitterTest.java index 0802a62aa..31aa5326c 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/QuerySplitterTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/QuerySplitterTest.java @@ -22,8 +22,8 @@ import static com.google.datastore.v1.client.DatastoreHelper.makeOrder; import static com.google.datastore.v1.client.DatastoreHelper.makePropertyReference; import static com.google.datastore.v1.client.DatastoreHelper.makeValue; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.datastore.v1.Entity; import com.google.datastore.v1.EntityResult; @@ -46,13 +46,10 @@ import com.google.protobuf.Int32Value; import com.google.protobuf.Timestamp; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link QuerySplitterImpl}. */ -@RunWith(JUnit4.class) -public class QuerySplitterTest { +class QuerySplitterTest { private static final String PROJECT_ID = "project-id"; private static final PartitionId PARTITION = PartitionId.newBuilder().setProjectId(PROJECT_ID).build(); @@ -86,7 +83,7 @@ public class QuerySplitterTest { makeKey(KIND, String.format("%05d", 301)).setPartitionId(PARTITION).build(); @Test - public void disallowsSortOrder() { + void disallowsSortOrder() { Datastore datastore = factory.create(options.build()); Query queryWithOrder = query.toBuilder().addOrder(makeOrder("bar", Direction.ASCENDING)).build(); @@ -98,7 +95,7 @@ public void disallowsSortOrder() { } @Test - public void disallowsMultipleKinds() { + void disallowsMultipleKinds() { Datastore datastore = factory.create(options.build()); Query queryWithMultipleKinds = query.toBuilder() @@ -114,7 +111,7 @@ public void disallowsMultipleKinds() { } @Test - public void disallowsKindlessQuery() { + void disallowsKindlessQuery() { Datastore datastore = factory.create(options.build()); Query kindlessQuery = query.toBuilder().clearKind().build(); IllegalArgumentException exception = @@ -125,7 +122,7 @@ public void disallowsKindlessQuery() { } @Test - public void disallowsInequalityFilter() { + void disallowsInequalityFilter() { Datastore datastore = factory.create(options.build()); Query queryWithInequality = query.toBuilder() @@ -140,7 +137,7 @@ public void disallowsInequalityFilter() { } @Test - public void splitsMustBePositive() { + void splitsMustBePositive() { Datastore datastore = factory.create(options.build()); IllegalArgumentException exception = assertThrows( @@ -150,7 +147,7 @@ public void splitsMustBePositive() { } @Test - public void getSplits() throws Exception { + void getSplits() throws Exception { Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; @@ -197,7 +194,7 @@ public void getSplits() throws Exception { } @Test - public void getSplitsWithDatabaseId() throws Exception { + void getSplitsWithDatabaseId() throws Exception { Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; @@ -247,7 +244,7 @@ public void getSplitsWithDatabaseId() throws Exception { } @Test - public void notEnoughSplits() throws Exception { + void notEnoughSplits() throws Exception { Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; @@ -288,7 +285,7 @@ public void notEnoughSplits() throws Exception { } @Test - public void getSplits_withReadTime() throws Exception { + void getSplits_withReadTime() throws Exception { Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/RemoteRpcTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/RemoteRpcTest.java index 28e3f20b8..9ff665ed5 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/RemoteRpcTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/RemoteRpcTest.java @@ -15,9 +15,9 @@ */ package com.google.datastore.v1.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpTransport; @@ -36,18 +36,15 @@ import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPOutputStream; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Test for {@link RemoteRpc}. */ -@RunWith(JUnit4.class) -public class RemoteRpcTest { +class RemoteRpcTest { private static final String METHOD_NAME = "methodName"; @Test - public void testException() { + void testException() { Status statusProto = Status.newBuilder() .setCode(Code.UNAUTHENTICATED_VALUE) @@ -69,7 +66,7 @@ public void testException() { } @Test - public void testInvalidProtoException() { + void testInvalidProtoException() { DatastoreException exception = RemoteRpc.makeException( "url", @@ -87,7 +84,7 @@ public void testInvalidProtoException() { } @Test - public void testEmptyProtoException() { + void testEmptyProtoException() { Status statusProto = Status.newBuilder().build(); DatastoreException exception = RemoteRpc.makeException( @@ -106,7 +103,7 @@ public void testEmptyProtoException() { } @Test - public void testEmptyProtoExceptionUnauthenticated() { + void testEmptyProtoExceptionUnauthenticated() { Status statusProto = Status.newBuilder().build(); DatastoreException exception = RemoteRpc.makeException( @@ -123,7 +120,7 @@ public void testEmptyProtoExceptionUnauthenticated() { } @Test - public void testPlainTextException() { + void testPlainTextException() { DatastoreException exception = RemoteRpc.makeException( "url", @@ -140,7 +137,7 @@ public void testPlainTextException() { } @Test - public void testGzip() throws IOException, DatastoreException { + void testGzip() throws IOException, DatastoreException { BeginTransactionResponse response = newBeginTransactionResponse(); InjectedTestValues injectedTestValues = new InjectedTestValues(gzip(response), new byte[1], true); @@ -157,7 +154,7 @@ public void testGzip() throws IOException, DatastoreException { } @Test - public void testHttpHeaders_expectE2eChecksumHeader() throws IOException { + void testHttpHeaders_expectE2eChecksumHeader() throws IOException { // Enable E2E-Checksum system env variable RemoteRpc.setSystemEnvE2EChecksum(true); String projectId = "project-id"; @@ -180,7 +177,7 @@ public void testHttpHeaders_expectE2eChecksumHeader() throws IOException { } @Test - public void testHttpHeaders_doNotExpectE2eChecksumHeader() throws IOException { + void testHttpHeaders_doNotExpectE2eChecksumHeader() throws IOException { // disable E2E-Checksum system env variable RemoteRpc.setSystemEnvE2EChecksum(false); String projectId = "project-id"; @@ -202,7 +199,7 @@ public void testHttpHeaders_doNotExpectE2eChecksumHeader() throws IOException { } @Test - public void testHttpHeaders_prefixHeader() throws IOException { + void testHttpHeaders_prefixHeader() throws IOException { String projectId = "my-project"; String databaseId = "my-db"; MessageLite request = diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/it/ITDatastoreProtoClientTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/it/ITDatastoreProtoClientTest.java index 3e6cf025e..089e864f2 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/it/ITDatastoreProtoClientTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/it/ITDatastoreProtoClientTest.java @@ -30,10 +30,10 @@ import java.io.IOException; import java.security.GeneralSecurityException; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class ITDatastoreProtoClientTest { +class ITDatastoreProtoClientTest { private static Datastore DATASTORE; @@ -42,13 +42,13 @@ public class ITDatastoreProtoClientTest { private static final String KIND = "test-kind"; private static final String PROJECT_ID = System.getenv(DatastoreHelper.PROJECT_ID_ENV_VAR); - @Before - public void setUp() throws GeneralSecurityException, IOException { + @BeforeEach + void setUp() throws GeneralSecurityException, IOException { DATASTORE = DatastoreHelper.getDatastoreFromEnv(); } @Test - public void testQuerySplitterWithDefaultDb() throws DatastoreException { + void testQuerySplitterWithDefaultDb() throws DatastoreException { Filter propertyFilter = makeFilter("foo", PropertyFilter.Operator.EQUAL, makeValue("value")).build(); Query query = @@ -70,7 +70,7 @@ public void testQuerySplitterWithDefaultDb() throws DatastoreException { } @Test - public void testQuerySplitterWithDb() throws DatastoreException { + void testQuerySplitterWithDb() throws DatastoreException { Filter propertyFilter = makeFilter("foo", PropertyFilter.Operator.EQUAL, makeValue("value")).build(); Query query = diff --git a/google-cloud-datastore-utils/pom.xml b/google-cloud-datastore-utils/pom.xml index 74f717c84..d6be9abaa 100644 --- a/google-cloud-datastore-utils/pom.xml +++ b/google-cloud-datastore-utils/pom.xml @@ -69,8 +69,18 @@ - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.vintage + junit-vintage-engine test diff --git a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreClientTest.java b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreClientTest.java index 31b0f6440..0a916743e 100644 --- a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreClientTest.java +++ b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreClientTest.java @@ -16,11 +16,10 @@ package com.google.datastore.utils; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; @@ -51,13 +50,10 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.SocketTimeoutException; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link DatastoreFactory} and {@link Datastore}. */ -@RunWith(JUnit4.class) -public class DatastoreClientTest { +class DatastoreClientTest { private static final String PROJECT_ID = "project-id"; private DatastoreFactory factory = new MockDatastoreFactory(); @@ -65,7 +61,7 @@ public class DatastoreClientTest { new DatastoreOptions.Builder().projectId(PROJECT_ID).credential(new MockCredential()); @Test - public void options_NoProjectIdOrProjectEndpoint() { + void options_NoProjectIdOrProjectEndpoint() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -77,7 +73,7 @@ public void options_NoProjectIdOrProjectEndpoint() { } @Test - public void options_ProjectIdAndProjectEndpoint() throws Exception { + void options_ProjectIdAndProjectEndpoint() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -92,7 +88,7 @@ public void options_ProjectIdAndProjectEndpoint() throws Exception { } @Test - public void options_LocalHostAndProjectEndpoint() throws Exception { + void options_LocalHostAndProjectEndpoint() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -107,7 +103,7 @@ public void options_LocalHostAndProjectEndpoint() throws Exception { } @Test - public void options_HostAndProjectEndpoint() throws Exception { + void options_HostAndProjectEndpoint() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -122,7 +118,7 @@ public void options_HostAndProjectEndpoint() throws Exception { } @Test - public void options_HostAndLocalHost() throws Exception { + void options_HostAndLocalHost() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -136,7 +132,7 @@ public void options_HostAndLocalHost() throws Exception { } @Test - public void options_InvalidLocalHost() throws Exception { + void options_InvalidLocalHost() throws Exception { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -150,7 +146,7 @@ public void options_InvalidLocalHost() throws Exception { } @Test - public void options_SchemeInLocalHost() { + void options_SchemeInLocalHost() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -161,7 +157,7 @@ public void options_SchemeInLocalHost() { } @Test - public void options_InvalidHost() { + void options_InvalidHost() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -175,7 +171,7 @@ public void options_InvalidHost() { } @Test - public void options_SchemeInHost() { + void options_SchemeInHost() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -187,12 +183,12 @@ public void options_SchemeInHost() { } @Test - public void create_NullOptions() throws Exception { + void create_NullOptions() throws Exception { assertThrows(NullPointerException.class, () -> factory.create(null)); } @Test - public void create_Host() { + void create_Host() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -204,7 +200,7 @@ public void create_Host() { } @Test - public void create_LocalHost() { + void create_LocalHost() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -216,7 +212,7 @@ public void create_LocalHost() { } @Test - public void create_LocalHostIp() { + void create_LocalHostIp() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -228,7 +224,7 @@ public void create_LocalHostIp() { } @Test - public void create_DefaultHost() { + void create_DefaultHost() { Datastore datastore = factory.create(new DatastoreOptions.Builder().projectId(PROJECT_ID).build()); assertThat(datastore.remoteRpc.getUrl()) @@ -236,7 +232,7 @@ public void create_DefaultHost() { } @Test - public void create_ProjectEndpoint() { + void create_ProjectEndpoint() { Datastore datastore = factory.create( new DatastoreOptions.Builder() @@ -247,7 +243,7 @@ public void create_ProjectEndpoint() { } @Test - public void create_ProjectEndpointNoScheme() { + void create_ProjectEndpointNoScheme() { IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, @@ -264,7 +260,7 @@ public void create_ProjectEndpointNoScheme() { } @Test - public void initializer() throws Exception { + void initializer() throws Exception { options.initializer( new HttpRequestInitializer() { @Override @@ -282,21 +278,21 @@ public void initialize(HttpRequest request) { } @Test - public void allocateIds() throws Exception { + void allocateIds() throws Exception { AllocateIdsRequest.Builder request = AllocateIdsRequest.newBuilder(); AllocateIdsResponse.Builder response = AllocateIdsResponse.newBuilder(); expectRpc("allocateIds", request.build(), response.build()); } @Test - public void lookup() throws Exception { + void lookup() throws Exception { LookupRequest.Builder request = LookupRequest.newBuilder(); LookupResponse.Builder response = LookupResponse.newBuilder(); expectRpc("lookup", request.build(), response.build()); } @Test - public void beginTransaction() throws Exception { + void beginTransaction() throws Exception { BeginTransactionRequest.Builder request = BeginTransactionRequest.newBuilder(); BeginTransactionResponse.Builder response = BeginTransactionResponse.newBuilder(); response.setTransaction(ByteString.copyFromUtf8("project-id")); @@ -304,7 +300,7 @@ public void beginTransaction() throws Exception { } @Test - public void commit() throws Exception { + void commit() throws Exception { CommitRequest.Builder request = CommitRequest.newBuilder(); request.setTransaction(ByteString.copyFromUtf8("project-id")); CommitResponse.Builder response = CommitResponse.newBuilder(); @@ -312,14 +308,14 @@ public void commit() throws Exception { } @Test - public void reserveIds() throws Exception { + void reserveIds() throws Exception { ReserveIdsRequest.Builder request = ReserveIdsRequest.newBuilder(); ReserveIdsResponse.Builder response = ReserveIdsResponse.newBuilder(); expectRpc("reserveIds", request.build(), response.build()); } @Test - public void rollback() throws Exception { + void rollback() throws Exception { RollbackRequest.Builder request = RollbackRequest.newBuilder(); request.setTransaction(ByteString.copyFromUtf8("project-id")); RollbackResponse.Builder response = RollbackResponse.newBuilder(); @@ -327,7 +323,7 @@ public void rollback() throws Exception { } @Test - public void runQuery() throws Exception { + void runQuery() throws Exception { RunQueryRequest.Builder request = RunQueryRequest.newBuilder(); request.getQueryBuilder(); RunQueryResponse.Builder response = RunQueryResponse.newBuilder(); @@ -339,7 +335,7 @@ public void runQuery() throws Exception { } @Test - public void runAggregationQuery() throws Exception { + void runAggregationQuery() throws Exception { RunAggregationQueryRequest.Builder request = RunAggregationQueryRequest.newBuilder(); RunAggregationQueryResponse.Builder response = RunAggregationQueryResponse.newBuilder(); expectRpc("runAggregationQuery", request.build(), response.build()); @@ -366,41 +362,39 @@ private void expectRpc(String methodName, Message request, Message response) thr assertEquals(0, datastore.getRpcCount()); mockClient.setNextError(400, Code.INVALID_ARGUMENT, "oops"); - try { - call.invoke(datastore, callArgs); - fail(); - } catch (InvocationTargetException targetException) { - DatastoreException exception = (DatastoreException) targetException.getCause(); - assertEquals(Code.INVALID_ARGUMENT, exception.getCode()); - assertEquals(methodName, exception.getMethodName()); - assertEquals("oops", exception.getMessage()); - } + DatastoreException exception = + assertThrows( + DatastoreException.class, + () -> { + try { + call.invoke(datastore, callArgs); + } catch (InvocationTargetException e) { + throw (Exception) e.getCause(); + } + }); + assertEquals(Code.INVALID_ARGUMENT, exception.getCode()); + assertEquals(methodName, exception.getMethodName()); + assertEquals("oops", exception.getMessage()); SocketTimeoutException socketTimeoutException = new SocketTimeoutException("ste"); mockClient.setNextException(socketTimeoutException); - try { - call.invoke(datastore, callArgs); - fail(); - } catch (InvocationTargetException targetException) { - DatastoreException exception = (DatastoreException) targetException.getCause(); - assertEquals(Code.DEADLINE_EXCEEDED, exception.getCode()); - assertEquals(methodName, exception.getMethodName()); - assertEquals("Deadline exceeded", exception.getMessage()); - assertSame(socketTimeoutException, exception.getCause()); - } + InvocationTargetException ex2 = + assertThrows(InvocationTargetException.class, () -> call.invoke(datastore, callArgs)); + DatastoreException exception1 = (DatastoreException) ex2.getCause(); + assertEquals(Code.DEADLINE_EXCEEDED, exception1.getCode()); + assertEquals(methodName, exception1.getMethodName()); + assertEquals("Deadline exceeded", exception1.getMessage()); + assertSame(socketTimeoutException, exception1.getCause()); IOException ioException = new IOException("ioe"); mockClient.setNextException(ioException); - try { - call.invoke(datastore, callArgs); - fail(); - } catch (InvocationTargetException targetException) { - DatastoreException exception = (DatastoreException) targetException.getCause(); - assertEquals(Code.UNAVAILABLE, exception.getCode()); - assertEquals(methodName, exception.getMethodName()); - assertEquals("I/O error", exception.getMessage()); - assertSame(ioException, exception.getCause()); - } + InvocationTargetException ex3 = + assertThrows(InvocationTargetException.class, () -> call.invoke(datastore, callArgs)); + DatastoreException exception2 = (DatastoreException) ex3.getCause(); + assertEquals(Code.UNAVAILABLE, exception2.getCode()); + assertEquals(methodName, exception2.getMethodName()); + assertEquals("I/O error", exception2.getMessage()); + assertSame(ioException, exception2.getCause()); assertEquals(3, datastore.getRpcCount()); } diff --git a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreFactoryTest.java b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreFactoryTest.java index 2a3d5a38f..fa8854dfa 100644 --- a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreFactoryTest.java +++ b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreFactoryTest.java @@ -15,21 +15,18 @@ */ package com.google.datastore.utils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.javanet.NetHttpTransport; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Test for {@link DatastoreFactory}. */ -@RunWith(JUnit4.class) -public class DatastoreFactoryTest { +class DatastoreFactoryTest { private static final String PROJECT_ID = "project-id"; private DatastoreFactory factory = DatastoreFactory.get(); @@ -39,7 +36,7 @@ public class DatastoreFactoryTest { * its own. */ @Test - public void makeClient_Default() { + void makeClient_Default() { DatastoreOptions options = new DatastoreOptions.Builder().projectId(PROJECT_ID).build(); HttpRequestFactory f = factory.makeClient(options); assertNotNull(f.getTransport()); @@ -51,7 +48,7 @@ public void makeClient_Default() { * credential. */ @Test - public void makeClient_WithCredential() { + void makeClient_WithCredential() { NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = new GoogleCredential.Builder().setTransport(transport).build(); DatastoreOptions options = @@ -62,7 +59,7 @@ public void makeClient_WithCredential() { /** Specifying a transport, but not a credential, the factory will use the transport specified. */ @Test - public void makeClient_WithTransport() { + void makeClient_WithTransport() { NetHttpTransport transport = new NetHttpTransport(); DatastoreOptions options = new DatastoreOptions.Builder().projectId(PROJECT_ID).transport(transport).build(); @@ -75,7 +72,7 @@ public void makeClient_WithTransport() { * the one in the credential. */ @Test - public void makeClient_WithCredentialTransport() { + void makeClient_WithCredentialTransport() { NetHttpTransport credTransport = new NetHttpTransport(); NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = diff --git a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreHelperTest.java b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreHelperTest.java index 246202444..e35008acb 100644 --- a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreHelperTest.java +++ b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/DatastoreHelperTest.java @@ -16,8 +16,8 @@ package com.google.datastore.utils; import static com.google.datastore.utils.DatastoreHelper.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.datastore.v1.Key; import com.google.datastore.v1.PartitionId; @@ -26,13 +26,10 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Timestamp; import java.util.Date; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link DatastoreHelper}. */ -@RunWith(JUnit4.class) -public class DatastoreHelperTest { +class DatastoreHelperTest { private static final Key PARENT = Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Parent").setId(23L)).build(); @@ -44,65 +41,58 @@ public class DatastoreHelperTest { Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Child").setId(26L)).build(); @Test - public void testMakeKey_BadTypeForKind() { - try { - DatastoreHelper.makeKey(new Object()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + void testMakeKey_BadTypeForKind() { + assertThrows(IllegalArgumentException.class, () -> DatastoreHelper.makeKey(new Object())); } @Test - public void testMakeKey_BadTypeForNameId() { - try { - DatastoreHelper.makeKey("kind", new Object()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + void testMakeKey_BadTypeForNameId() { + assertThrows( + IllegalArgumentException.class, () -> DatastoreHelper.makeKey("kind", new Object())); } @Test - public void testMakeKey_Empty() { + void testMakeKey_Empty() { assertEquals(Key.newBuilder().build(), DatastoreHelper.makeKey().build()); } @Test - public void testMakeKey_Incomplete() { + void testMakeKey_Incomplete() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo")).build(), makeKey("Foo").build()); } @Test - public void testMakeKey_IdInt() { + void testMakeKey_IdInt() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)).build(), makeKey("Foo", 1).build()); } @Test - public void testMakeKey_IdLong() { + void testMakeKey_IdLong() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)).build(), makeKey("Foo", 1L).build()); } @Test - public void testMakeKey_IdShort() { + void testMakeKey_IdShort() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)).build(), makeKey("Foo", (short) 1).build()); } @Test - public void testMakeKey_Name() { + void testMakeKey_Name() { assertEquals( Key.newBuilder().addPath(Key.PathElement.newBuilder().setKind("Foo").setName("hi")).build(), makeKey("Foo", "hi").build()); } @Test - public void testMakeKey_KindNameKind() { + void testMakeKey_KindNameKind() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setName("hi")) @@ -112,7 +102,7 @@ public void testMakeKey_KindNameKind() { } @Test - public void testMakeKey_KeyKind() { + void testMakeKey_KeyKind() { // 1 key at the beginning of the series assertEquals( Key.newBuilder() @@ -123,7 +113,7 @@ public void testMakeKey_KeyKind() { } @Test - public void testMakeKey_KindIdKeyKind() { + void testMakeKey_KindIdKeyKind() { // 1 key in the middle of the series assertEquals( Key.newBuilder() @@ -135,7 +125,7 @@ public void testMakeKey_KindIdKeyKind() { } @Test - public void testMakeKey_KindIdKey() { + void testMakeKey_KindIdKey() { // 1 key at the end of the series assertEquals( Key.newBuilder() @@ -146,7 +136,7 @@ public void testMakeKey_KindIdKey() { } @Test - public void testMakeKey_KeyKindIdKey() { + void testMakeKey_KeyKindIdKey() { // 1 key at the beginning and 1 key at the end of the series assertEquals( Key.newBuilder() @@ -158,13 +148,13 @@ public void testMakeKey_KeyKindIdKey() { } @Test - public void testMakeKey_Key() { + void testMakeKey_Key() { // Just 1 key assertEquals(Key.newBuilder().addPath(CHILD.getPath(0)).build(), makeKey(CHILD).build()); } @Test - public void testMakeKey_KeyKey() { + void testMakeKey_KeyKey() { // Just 2 keys assertEquals( Key.newBuilder().addPath(PARENT.getPath(0)).addPath(CHILD.getPath(0)).build(), @@ -172,7 +162,7 @@ public void testMakeKey_KeyKey() { } @Test - public void testMakeKey_KeyKeyKey() { + void testMakeKey_KeyKeyKey() { // Just 3 keys assertEquals( Key.newBuilder() @@ -184,7 +174,7 @@ public void testMakeKey_KeyKeyKey() { } @Test - public void testMakeKey_KeyMultiLevelKey() { + void testMakeKey_KeyMultiLevelKey() { // 1 key with 2 elements assertEquals( Key.newBuilder() @@ -196,7 +186,7 @@ public void testMakeKey_KeyMultiLevelKey() { } @Test - public void testMakeKey_MultiLevelKeyKey() { + void testMakeKey_MultiLevelKeyKey() { // 1 key with 2 elements assertEquals( Key.newBuilder() @@ -208,7 +198,7 @@ public void testMakeKey_MultiLevelKeyKey() { } @Test - public void testMakeKey_MultiLevelKey() { + void testMakeKey_MultiLevelKey() { // 1 key with 3 elements assertEquals( Key.newBuilder() @@ -220,7 +210,7 @@ public void testMakeKey_MultiLevelKey() { } @Test - public void testMakeKey_PartitionId() { + void testMakeKey_PartitionId() { PartitionId partitionId = PartitionId.newBuilder().setNamespaceId("namespace-id").build(); Key parent = PARENT.toBuilder().setPartitionId(partitionId).build(); assertEquals( @@ -233,21 +223,20 @@ public void testMakeKey_PartitionId() { } @Test - public void testMakeKey_NonMatchingPartitionId2() { + void testMakeKey_NonMatchingPartitionId2() { PartitionId partitionId1 = PartitionId.newBuilder().setNamespaceId("namespace-id").build(); PartitionId partitionId2 = PartitionId.newBuilder().setNamespaceId("another-namespace-id").build(); - try { - makeKey( - PARENT.toBuilder().setPartitionId(partitionId1).build(), - CHILD.toBuilder().setPartitionId(partitionId2).build()); - fail("expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + assertThrows( + IllegalArgumentException.class, + () -> + makeKey( + PARENT.toBuilder().setPartitionId(partitionId1).build(), + CHILD.toBuilder().setPartitionId(partitionId2).build())); } @Test - public void testMakeTimestampValue() throws Exception { + void testMakeTimestampValue() throws Exception { // Test cases with nanos == 0. assertConversion(-50_000, -50, 0); assertConversion(-1_000, -1, 0); @@ -298,20 +287,12 @@ private void assertTimestampToMilliseconds(long millis, long seconds, int nanos) } @Test - public void testProjectionHandling() { + void testProjectionHandling() { assertEquals( ByteString.copyFromUtf8("hi"), getByteString(makeValue("hi").setMeaning(18).build())); - try { - getByteString(makeValue("hi").build()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + assertThrows(IllegalArgumentException.class, () -> getByteString(makeValue("hi").build())); assertEquals(new Date(1), toDate(makeValue(1000).setMeaning(18).build())); - try { - toDate(makeValue(1000).build()); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + assertThrows(IllegalArgumentException.class, () -> toDate(makeValue(1000).build())); } } diff --git a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/QuerySplitterTest.java b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/QuerySplitterTest.java index cad9502ae..62d64e0f6 100644 --- a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/QuerySplitterTest.java +++ b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/QuerySplitterTest.java @@ -17,8 +17,8 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.datastore.utils.DatastoreHelper.*; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.datastore.utils.testing.MockCredential; import com.google.datastore.utils.testing.MockDatastoreFactory; @@ -30,13 +30,10 @@ import com.google.protobuf.Int32Value; import com.google.protobuf.Timestamp; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Tests for {@link com.google.datastore.utils.QuerySplitterImpl}. */ -@RunWith(JUnit4.class) -public class QuerySplitterTest { +class QuerySplitterTest { private static final String PROJECT_ID = "project-id"; private static final PartitionId PARTITION = PartitionId.newBuilder().setProjectId(PROJECT_ID).build(); @@ -70,7 +67,7 @@ public class QuerySplitterTest { makeKey(KIND, String.format("%05d", 301)).setPartitionId(PARTITION).build(); @Test - public void disallowsSortOrder() { + void disallowsSortOrder() { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); Query queryWithOrder = query.toBuilder().addOrder(makeOrder("bar", Direction.ASCENDING)).build(); @@ -84,7 +81,7 @@ public void disallowsSortOrder() { } @Test - public void disallowsMultipleKinds() { + void disallowsMultipleKinds() { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); Query queryWithMultipleKinds = query.toBuilder() @@ -100,7 +97,7 @@ public void disallowsMultipleKinds() { } @Test - public void disallowsKindlessQuery() { + void disallowsKindlessQuery() { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); Query kindlessQuery = query.toBuilder().clearKind().build(); IllegalArgumentException exception = @@ -113,7 +110,7 @@ public void disallowsKindlessQuery() { } @Test - public void disallowsInequalityFilter() { + void disallowsInequalityFilter() { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); Query queryWithInequality = query.toBuilder() @@ -129,7 +126,7 @@ public void disallowsInequalityFilter() { } @Test - public void splitsMustBePositive() { + void splitsMustBePositive() { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); IllegalArgumentException exception = assertThrows( @@ -141,7 +138,7 @@ public void splitsMustBePositive() { } @Test - public void getSplits() throws Exception { + void getSplits() throws Exception { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; @@ -189,7 +186,7 @@ public void getSplits() throws Exception { } @Test - public void getSplitsWithDatabaseId() throws Exception { + void getSplitsWithDatabaseId() throws Exception { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; @@ -241,7 +238,7 @@ public void getSplitsWithDatabaseId() throws Exception { } @Test - public void notEnoughSplits() throws Exception { + void notEnoughSplits() throws Exception { com.google.datastore.utils.Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; @@ -283,7 +280,7 @@ public void notEnoughSplits() throws Exception { } @Test - public void getSplits_withReadTime() throws Exception { + void getSplits_withReadTime() throws Exception { Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) factory; diff --git a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/RemoteRpcTest.java b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/RemoteRpcTest.java index ae4d7a23e..161781273 100644 --- a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/RemoteRpcTest.java +++ b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/RemoteRpcTest.java @@ -15,7 +15,8 @@ */ package com.google.datastore.utils; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpTransport; @@ -34,18 +35,15 @@ import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPOutputStream; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.Test; /** Test for {@link RemoteRpc}. */ -@RunWith(JUnit4.class) -public class RemoteRpcTest { +class RemoteRpcTest { private static final String METHOD_NAME = "methodName"; @Test - public void testException() { + void testException() { Status statusProto = Status.newBuilder() .setCode(Code.UNAUTHENTICATED_VALUE) @@ -67,7 +65,7 @@ public void testException() { } @Test - public void testInvalidProtoException() { + void testInvalidProtoException() { DatastoreException exception = RemoteRpc.makeException( "url", @@ -85,7 +83,7 @@ public void testInvalidProtoException() { } @Test - public void testEmptyProtoException() { + void testEmptyProtoException() { Status statusProto = Status.newBuilder().build(); DatastoreException exception = RemoteRpc.makeException( @@ -104,7 +102,7 @@ public void testEmptyProtoException() { } @Test - public void testEmptyProtoExceptionUnauthenticated() { + void testEmptyProtoExceptionUnauthenticated() { Status statusProto = Status.newBuilder().build(); DatastoreException exception = RemoteRpc.makeException( @@ -121,7 +119,7 @@ public void testEmptyProtoExceptionUnauthenticated() { } @Test - public void testPlainTextException() { + void testPlainTextException() { DatastoreException exception = RemoteRpc.makeException( "url", @@ -138,7 +136,7 @@ public void testPlainTextException() { } @Test - public void testGzip() throws IOException, DatastoreException { + void testGzip() throws IOException, DatastoreException { BeginTransactionResponse response = newBeginTransactionResponse(); InjectedTestValues injectedTestValues = new InjectedTestValues(gzip(response), new byte[1], true); @@ -155,7 +153,7 @@ public void testGzip() throws IOException, DatastoreException { } @Test - public void testHttpHeaders_apiFormat() throws IOException { + void testHttpHeaders_apiFormat() throws IOException { String projectId = "project-id"; MessageLite request = RollbackRequest.newBuilder().setTransaction(ByteString.copyFromUtf8(projectId)).build(); @@ -170,7 +168,7 @@ public void testHttpHeaders_apiFormat() throws IOException { } @Test - public void testHttpHeaders_prefixHeader() throws IOException { + void testHttpHeaders_prefixHeader() throws IOException { String projectId = "my-project"; String databaseId = "my-db"; MessageLite request = diff --git a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/it/ITDatastoreProtoClientTest.java b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/it/ITDatastoreProtoClientTest.java index d30c1cbdc..d8b172819 100644 --- a/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/it/ITDatastoreProtoClientTest.java +++ b/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/it/ITDatastoreProtoClientTest.java @@ -26,10 +26,10 @@ import java.io.IOException; import java.security.GeneralSecurityException; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class ITDatastoreProtoClientTest { +class ITDatastoreProtoClientTest { private static Datastore DATASTORE; @@ -38,13 +38,13 @@ public class ITDatastoreProtoClientTest { private static final String KIND = "test-kind"; private static final String PROJECT_ID = System.getenv(DatastoreHelper.PROJECT_ID_ENV_VAR); - @Before - public void setUp() throws GeneralSecurityException, IOException { + @BeforeEach + void setUp() throws GeneralSecurityException, IOException { DATASTORE = DatastoreHelper.getDatastoreFromEnv(); } @Test - public void testQuerySplitterWithDefaultDb() throws DatastoreException { + void testQuerySplitterWithDefaultDb() throws DatastoreException { Filter propertyFilter = makeFilter("foo", PropertyFilter.Operator.EQUAL, makeValue("value")).build(); Query query = @@ -66,7 +66,7 @@ public void testQuerySplitterWithDefaultDb() throws DatastoreException { } @Test - public void testQuerySplitterWithDb() throws DatastoreException { + void testQuerySplitterWithDb() throws DatastoreException { Filter propertyFilter = makeFilter("foo", PropertyFilter.Operator.EQUAL, makeValue("value")).build(); Query query = diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml index 30867c3e3..cc040759a 100644 --- a/google-cloud-datastore/pom.xml +++ b/google-cloud-datastore/pom.xml @@ -183,8 +183,23 @@ test - junit - junit + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.vintage + junit-vintage-engine test diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClient.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClient.java index 9ef7f1edf..a0530e22f 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClient.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java index 35f993cc8..6512501d6 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/DatastoreAdminSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/package-info.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/package-info.java index 73f593170..9e4186681 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/package-info.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStub.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStub.java index e5a17cc7d..87e0db23e 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStub.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java index 77314c4bc..4b0c50872 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/DatastoreAdminStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminCallableFactory.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminCallableFactory.java index fa1147044..47629c9a7 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminCallableFactory.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminStub.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminStub.java index 2e5f450ac..4d72d06cb 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminStub.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/GrpcDatastoreAdminStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminCallableFactory.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminCallableFactory.java index e56561c69..bb9ec0e59 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminCallableFactory.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminStub.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminStub.java index 7c1a53ea3..5fe4db699 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminStub.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/admin/v1/stub/HttpJsonDatastoreAdminStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreClient.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreClient.java index e8bea055f..dfbb17d18 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreClient.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreSettings.java index 74054341e..dd309d3f9 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreSettings.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/DatastoreSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/package-info.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/package-info.java index 0484a7c04..a5a708ed4 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/package-info.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStub.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStub.java index 231289f18..5dad98ef9 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStub.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java index a4554339d..780a68f81 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/DatastoreStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreCallableFactory.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreCallableFactory.java index ffe225259..d0423c6e6 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreCallableFactory.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreStub.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreStub.java index d98484faa..9efdf1e6c 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreStub.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/GrpcDatastoreStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreCallableFactory.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreCallableFactory.java index b12560ab1..fbb23e70b 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreCallableFactory.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreStub.java b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreStub.java index 4d77fcac2..d0c7e3591 100644 --- a/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreStub.java +++ b/google-cloud-datastore/src/main/java/com/google/cloud/datastore/v1/stub/HttpJsonDatastoreStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AbstractDatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AbstractDatastoreTest.java index 9d4ecac57..d3315e10c 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AbstractDatastoreTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AbstractDatastoreTest.java @@ -24,14 +24,14 @@ import static org.easymock.EasyMock.createStrictMock; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +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.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.ServiceOptions; import com.google.cloud.Timestamp; @@ -78,19 +78,22 @@ import java.util.Set; import java.util.function.Predicate; import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@RunWith(JUnit4.class) -public abstract class AbstractDatastoreTest { +abstract class AbstractDatastoreTest { private static final LocalDatastoreHelper helper = LocalDatastoreHelper.create(1.0, 9090); - protected static DatastoreOptions options = helper.getOptions(); - protected static Datastore datastore; - private static final String PROJECT_ID = options.getProjectId(); + protected static final DatastoreOptions options; + protected static final Datastore datastore; + private static final String PROJECT_ID; + + static { + options = helper.getOptions(); + datastore = options.getService(); + PROJECT_ID = options.getProjectId(); + } + private static final String KIND1 = "kind1"; private static final String KIND2 = "kind2"; private static final String KIND3 = "kind3"; @@ -162,13 +165,8 @@ public abstract class AbstractDatastoreTest { private DatastoreRpcFactory rpcFactoryMock; private DatastoreRpc rpcMock; - public AbstractDatastoreTest(DatastoreOptions options, Datastore datastore) { - this.options = options; - this.datastore = datastore; - } - - @Before - public void setUp() { + @BeforeEach + void setUp() { rpcFactoryMock = EasyMock.createStrictMock(DatastoreRpcFactory.class); rpcMock = EasyMock.createStrictMock(DatastoreRpc.class); DatastoreOpenTelemetryOptions.Builder otelOptionsBuilder = @@ -186,12 +184,12 @@ public void setUp() { } @Test - public void testGetOptions() { + void testGetOptions() { assertSame(options, datastore.getOptions()); } @Test - public void testNewTransactionCommit() { + void testNewTransactionCommit() { Transaction transaction = datastore.newTransaction(); transaction.add(ENTITY3); Entity entity2 = Entity.newBuilder(ENTITY2).clear().setNull("bla").build(); @@ -205,25 +203,15 @@ public void testNewTransactionCommit() { assertEquals(ENTITY3, list.get(2)); assertEquals(3, list.size()); - try { - transaction.commit(); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, transaction::commit); - try { - transaction.rollback(); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, transaction::rollback); verifyNotUsable(transaction); } @Test - public void testTransactionWithRead() { + void testTransactionWithRead() { Transaction transaction = datastore.newTransaction(); assertNull(transaction.get(KEY3)); transaction.add(ENTITY3); @@ -234,17 +222,12 @@ public void testTransactionWithRead() { assertEquals(ENTITY3, transaction.get(KEY3)); // update entity3 during the transaction datastore.put(Entity.newBuilder(ENTITY3).clear().build()); - transaction.update(ENTITY2); - try { - transaction.commit(); - fail("Expecting a failure"); - } catch (DatastoreException expected) { - assertEquals("ABORTED", expected.getReason()); - } + DatastoreException expected = assertThrows(DatastoreException.class, transaction::commit); + assertEquals("ABORTED", expected.getReason()); } @Test - public void testTransactionWithQuery() { + void testTransactionWithQuery() { Query query = Query.newEntityQueryBuilder() .setKind(KIND2) @@ -264,16 +247,12 @@ public void testTransactionWithQuery() { transaction.delete(ENTITY3.getKey()); // update entity2 during the transaction datastore.put(Entity.newBuilder(ENTITY2).clear().build()); - try { - transaction.commit(); - fail("Expecting a failure"); - } catch (DatastoreException expected) { - assertEquals("ABORTED", expected.getReason()); - } + DatastoreException expected = assertThrows(DatastoreException.class, transaction::commit); + assertEquals("ABORTED", expected.getReason()); } @Test - public void testNewTransactionRollback() { + void testNewTransactionRollback() { Transaction transaction = datastore.newTransaction(); transaction.add(ENTITY3); Entity entity2 = @@ -287,12 +266,7 @@ public void testNewTransactionRollback() { transaction.rollback(); transaction.rollback(); // should be safe to repeat rollback calls - try { - transaction.commit(); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, transaction::commit); verifyNotUsable(transaction); @@ -304,7 +278,7 @@ public void testNewTransactionRollback() { } @Test - public void testRunInTransactionWithReadWriteOption() { + void testRunInTransactionWithReadWriteOption() { EasyMock.expect(rpcMock.beginTransaction(EasyMock.anyObject(BeginTransactionRequest.class))) .andReturn(BeginTransactionResponse.getDefaultInstance()); @@ -345,37 +319,17 @@ public Integer run(DatastoreReaderWriter transaction) { } private void verifyNotUsable(DatastoreWriter writer) { - try { - writer.add(ENTITY3); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, () -> writer.add(ENTITY3)); - try { - writer.put(ENTITY3); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, () -> writer.put(ENTITY3)); - try { - writer.update(ENTITY3); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, () -> writer.update(ENTITY3)); - try { - writer.delete(ENTITY3.getKey()); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, () -> writer.delete(ENTITY3.getKey())); } @Test - public void testNewBatch() { + void testNewBatch() { Batch batch = datastore.newBatch(); Entity entity1 = Entity.newBuilder(ENTITY1).clear().build(); Entity entity2 = Entity.newBuilder(ENTITY2).clear().setNull("bla").build(); @@ -413,12 +367,7 @@ public void testNewBatch() { PARTIAL_ENTITY3.getProperties(), datastore.get(generatedKeys.get(0)).getProperties()); assertEquals(PARTIAL_ENTITY3.getKey(), IncompleteKey.newBuilder(generatedKeys.get(0)).build()); - try { - batch.submit(); - fail("Expecting a failure"); - } catch (DatastoreException ex) { - // expected to fail - } + assertThrows(DatastoreException.class, batch::submit); verifyNotUsable(batch); batch = datastore.newBatch(); @@ -435,7 +384,7 @@ public void testNewBatch() { } @Test - public void testRunGqlQueryNoCasting() { + void testRunGqlQueryNoCasting() { Query query1 = Query.newGqlQueryBuilder(ResultType.ENTITY, "select * from " + KIND1).build(); QueryResults results1 = datastore.run(query1); @@ -489,7 +438,7 @@ public void testRunGqlQueryNoCasting() { } @Test - public void testRunGqlQueryWithCasting() { + void testRunGqlQueryWithCasting() { @SuppressWarnings("unchecked") Query query1 = (Query) Query.newGqlQueryBuilder("select * from " + KIND1).build(); @@ -509,7 +458,7 @@ public void testRunGqlQueryWithCasting() { } @Test - public void testGqlQueryPagination() throws DatastoreException { + void testGqlQueryPagination() throws DatastoreException { List responses = buildResponsesForQueryPagination(); for (int i = 0; i < responses.size(); i++) { EasyMock.expect(rpcMock.runQuery(EasyMock.anyObject(RunQueryRequest.class))) @@ -530,7 +479,7 @@ public void testGqlQueryPagination() throws DatastoreException { } @Test - public void testRunAggregationQuery() { + void testRunAggregationQuery() { RunAggregationQueryResponse aggregationQueryResponse = placeholderAggregationQueryResponse(); EasyMock.expect(rpcMock.runAggregationQuery(matches(aggregationQueryWithAlias("total_count")))) .andReturn(aggregationQueryResponse); @@ -551,7 +500,7 @@ public void testRunAggregationQuery() { } @Test - public void testRunStructuredQuery() { + void testRunStructuredQuery() { Query query = Query.newEntityQueryBuilder().setKind(KIND1).setOrderBy(OrderBy.asc("__key__")).build(); QueryResults results1 = datastore.run(query); @@ -594,7 +543,7 @@ public void testRunStructuredQuery() { } @Test - public void testStructuredQueryPagination() throws DatastoreException { + void testStructuredQueryPagination() throws DatastoreException { List responses = buildResponsesForQueryPagination(); for (int i = 0; i < responses.size(); i++) { EasyMock.expect(rpcMock.runQuery(EasyMock.anyObject(RunQueryRequest.class))) @@ -613,7 +562,7 @@ public void testStructuredQueryPagination() throws DatastoreException { } @Test - public void testStructuredQueryPaginationWithMoreResults() throws DatastoreException { + void testStructuredQueryPaginationWithMoreResults() throws DatastoreException { List responses = buildResponsesForQueryPagination(); for (int i = 0; i < responses.size(); i++) { EasyMock.expect(rpcMock.runQuery(EasyMock.anyObject(RunQueryRequest.class))) @@ -676,7 +625,7 @@ private List buildResponsesForQueryPagination() { } @Test - public void testQueryPaginationWithLimit() throws DatastoreException { + void testQueryPaginationWithLimit() throws DatastoreException { List responses = buildResponsesForQueryPaginationWithLimit(); List endCursors = Lists.newArrayListWithCapacity(responses.size()); for (RunQueryResponse response : responses) { @@ -713,14 +662,14 @@ public void testQueryPaginationWithLimit() throws DatastoreException { } @Test - public void testRunKeyQueryWithOffset() { + void testRunKeyQueryWithOffset() { Query query = Query.newKeyQueryBuilder().setOffset(Integer.MAX_VALUE).build(); int numberOfEntities = datastore.run(query).getSkippedResults(); assertEquals(2, numberOfEntities); } @Test - public void testRunKeyQueryWithLimit() { + void testRunKeyQueryWithLimit() { datastore.put(ENTITY1, ENTITY2); Query keyQuery = Query.newKeyQueryBuilder().setLimit(2).build(); QueryResults queryResults = datastore.run(keyQuery); @@ -796,7 +745,7 @@ private List buildResponsesForQueryPaginationWithLimit() { } @Test - public void testEventualConsistencyQuery() { + void testEventualConsistencyQuery() { ReadOptions readOption = ReadOptions.newBuilder().setReadConsistencyValue(ReadConsistency.EVENTUAL_VALUE).build(); com.google.datastore.v1.GqlQuery query = @@ -817,7 +766,7 @@ public void testEventualConsistencyQuery() { } @Test - public void testReadTimeQuery() { + void testReadTimeQuery() { Timestamp timestamp = Timestamp.now(); ReadOptions readOption = ReadOptions.newBuilder().setReadTime(timestamp.toProto()).build(); com.google.datastore.v1.GqlQuery query = @@ -831,14 +780,18 @@ public void testReadTimeQuery() { EasyMock.expect(rpcMock.runQuery(expectedRequest.build())) .andReturn(RunQueryResponse.newBuilder().build()); EasyMock.replay(rpcFactoryMock, rpcMock); - Datastore datastore = rpcMockOptions.getService(); + com.google.cloud.datastore.Datastore datastore = rpcMockOptions.getService(); datastore.run( Query.newGqlQueryBuilder("FROM * SELECT *").build(), ReadOption.readTime(timestamp)); + datastore.get( + ImmutableList.of(KEY1), com.google.cloud.datastore.ReadOption.readTime(timestamp)); + datastore.fetch( + ImmutableList.of(KEY1), com.google.cloud.datastore.ReadOption.readTime(timestamp)); EasyMock.verify(rpcFactoryMock, rpcMock); } @Test - public void testToUrlSafe() { + void testToUrlSafe() { byte[][] invalidUtf8 = new byte[][] {{(byte) 0xfe}, {(byte) 0xc1, (byte) 0xbf}, {(byte) 0xc0}, {(byte) 0x80}}; for (byte[] bytes : invalidUtf8) { @@ -849,7 +802,7 @@ public void testToUrlSafe() { } @Test - public void testAllocateId() { + void testAllocateId() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(KIND1); IncompleteKey pk1 = keyFactory.newKey(); Key key1 = datastore.allocateId(pk1); @@ -865,16 +818,13 @@ public void testAllocateId() { assertNotEquals(key1, key2); assertEquals(Key.newBuilder(pk1, key2.getId()).build(), key2); - try { - datastore.allocateId(key1); - fail("Expecting a failure"); - } catch (IllegalArgumentException expected) { - assertEquals(expected.getMessage(), "keys must be IncompleteKey instances"); - } + IllegalArgumentException expected = + assertThrows(IllegalArgumentException.class, () -> datastore.allocateId(key1)); + assertEquals(expected.getMessage(), "keys must be IncompleteKey instances"); } @Test - public void testAllocateIdArray() { + void testAllocateIdArray() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(KIND1); IncompleteKey incompleteKey1 = keyFactory.newKey(); IncompleteKey incompleteKey2 = @@ -886,16 +836,15 @@ public void testAllocateIdArray() { assertEquals(Key.newBuilder(incompleteKey1, result1.get(2).getId()).build(), result1.get(2)); assertEquals(Key.newBuilder(incompleteKey2, result1.get(1).getId()).build(), result1.get(1)); - try { - datastore.allocateId(incompleteKey1, incompleteKey2, key3); - fail("expecting a failure"); - } catch (IllegalArgumentException expected) { - assertEquals(expected.getMessage(), "keys must be IncompleteKey instances"); - } + IllegalArgumentException expected = + assertThrows( + IllegalArgumentException.class, + () -> datastore.allocateId(incompleteKey1, incompleteKey2, key3)); + assertEquals(expected.getMessage(), "keys must be IncompleteKey instances"); } @Test - public void testReserveIds() { + void testReserveIds() { ReserveIdsRequest reserveIdsRequest = ReserveIdsRequest.newBuilder().setProjectId(PROJECT_ID).addKeys(KEY1.toPb()).build(); EasyMock.expect(rpcMock.reserveIds(reserveIdsRequest)) @@ -908,7 +857,7 @@ public void testReserveIds() { } @Test - public void testReserveIdsWithKeys() { + void testReserveIdsWithKeys() { Datastore datastore = createStrictMock(Datastore.class); EasyMock.expect(datastore.reserveIds(KEY1, KEY2)).andReturn(Arrays.asList(KEY1, KEY2)); replay(datastore); @@ -919,7 +868,7 @@ public void testReserveIdsWithKeys() { } @Test - public void testGet() { + void testGet() { Entity entity = datastore.get(KEY3); assertNull(entity); @@ -944,7 +893,7 @@ public void testGet() { } @Test - public void testLookupEventualConsistency() { + void testLookupEventualConsistency() { ReadOptions readOption = ReadOptions.newBuilder().setReadConsistencyValue(ReadConsistency.EVENTUAL_VALUE).build(); com.google.datastore.v1.Key key = @@ -974,30 +923,23 @@ public void testLookupEventualConsistency() { } @Test - public void testLookupReadTime() { + void testLookupReadTime() { Timestamp timestamp = Timestamp.now(); ReadOptions readOption = ReadOptions.newBuilder().setReadTime(timestamp.toProto()).build(); - com.google.datastore.v1.Key key = - com.google.datastore.v1.Key.newBuilder() - .setPartitionId(PartitionId.newBuilder().setProjectId(PROJECT_ID).build()) - .addPath( - com.google.datastore.v1.Key.PathElement.newBuilder() - .setKind("kind1") - .setName("name") - .build()) - .build(); - LookupRequest lookupRequest = - LookupRequest.newBuilder() - .setProjectId(PROJECT_ID) + com.google.datastore.v1.GqlQuery query = + com.google.datastore.v1.GqlQuery.newBuilder().setQueryString("FROM * SELECT *").build(); + RunQueryRequest.Builder expectedRequest = + RunQueryRequest.newBuilder() .setReadOptions(readOption) - .addKeys(key) - .build(); - EasyMock.expect(rpcMock.lookup(lookupRequest)) - .andReturn(LookupResponse.newBuilder().build()) - .times(3); + .setGqlQuery(query) + .setProjectId(PROJECT_ID) + .setPartitionId(PartitionId.newBuilder().setProjectId(PROJECT_ID).build()); + EasyMock.expect(rpcMock.runQuery(expectedRequest.build())) + .andReturn(RunQueryResponse.newBuilder().build()); EasyMock.replay(rpcFactoryMock, rpcMock); com.google.cloud.datastore.Datastore datastore = rpcMockOptions.getService(); - datastore.get(KEY1, com.google.cloud.datastore.ReadOption.readTime(timestamp)); + datastore.run( + Query.newGqlQueryBuilder("FROM * SELECT *").build(), ReadOption.readTime(timestamp)); datastore.get( ImmutableList.of(KEY1), com.google.cloud.datastore.ReadOption.readTime(timestamp)); datastore.fetch( @@ -1006,7 +948,7 @@ public void testLookupReadTime() { } @Test - public void testGetArrayNoDeferredResults() { + void testGetArrayNoDeferredResults() { datastore.put(ENTITY3); Iterator result = datastore.fetch(KEY1, Key.newBuilder(KEY1).setName("bla").build(), KEY2, KEY3).iterator(); @@ -1027,17 +969,13 @@ public void testGetArrayNoDeferredResults() { assertEquals(EMPTY_LIST_VALUE, entity3.getValue("emptyList")); assertEquals(8, entity3.getNames().size()); assertFalse(entity3.contains("bla")); - try { - entity3.getString("str"); - fail("Expecting a failure"); - } catch (DatastoreException expected) { - // expected - no such property - } + DatastoreException expected = + assertThrows(DatastoreException.class, () -> entity3.getString("str")); assertFalse(result.hasNext()); } @Test - public void testGetArrayDeferredResults() throws DatastoreException { + void testGetArrayDeferredResults() throws DatastoreException { Set requestedKeys = new HashSet<>(); requestedKeys.add(KEY1); requestedKeys.add(KEY2); @@ -1053,7 +991,7 @@ public void testGetArrayDeferredResults() throws DatastoreException { } @Test - public void testFetchArrayDeferredResults() throws DatastoreException { + void testFetchArrayDeferredResults() throws DatastoreException { List foundEntities = createDatastoreForDeferredLookup().fetch(KEY1, KEY2, KEY3, KEY4, KEY5); assertEquals(foundEntities.get(0).getKey(), KEY1); @@ -1112,18 +1050,13 @@ private Datastore createDatastoreForDeferredLookup() throws DatastoreException { } @Test - public void testAddEntity() { + void testAddEntity() { List keys = datastore.fetch(ENTITY1.getKey(), ENTITY3.getKey()); assertEquals(ENTITY1, keys.get(0)); assertNull(keys.get(1)); assertEquals(2, keys.size()); - try { - datastore.add(ENTITY1); - fail("Expecting a failure"); - } catch (DatastoreException expected) { - // expected; - } + assertThrows(DatastoreException.class, () -> datastore.add(ENTITY1)); List entities = datastore.add(ENTITY3, PARTIAL_ENTITY1, PARTIAL_ENTITY2); assertEquals(ENTITY3, datastore.get(ENTITY3.getKey())); @@ -1137,18 +1070,13 @@ public void testAddEntity() { } @Test - public void testUpdate() { + void testUpdate() { List keys = datastore.fetch(ENTITY1.getKey(), ENTITY3.getKey()); assertEquals(ENTITY1, keys.get(0)); assertNull(keys.get(1)); assertEquals(2, keys.size()); - try { - datastore.update(ENTITY3); - fail("Expecting a failure"); - } catch (DatastoreException expected) { - // expected; - } + assertThrows(DatastoreException.class, () -> datastore.update(ENTITY3)); datastore.add(ENTITY3); assertEquals(ENTITY3, datastore.get(ENTITY3.getKey())); Entity entity3 = Entity.newBuilder(ENTITY3).clear().set("bla", new NullValue()).build(); @@ -1158,7 +1086,7 @@ public void testUpdate() { } @Test - public void testPut() { + void testPut() { Entity updatedEntity = Entity.newBuilder(ENTITY1).set("new_property", 42L).build(); assertEquals(updatedEntity, datastore.put(updatedEntity)); assertEquals(updatedEntity, datastore.get(updatedEntity.getKey())); @@ -1179,7 +1107,7 @@ public void testPut() { } @Test - public void testDelete() { + void testDelete() { Iterator keys = datastore.fetch(ENTITY1.getKey(), ENTITY2.getKey(), ENTITY3.getKey()).iterator(); assertEquals(ENTITY1, keys.next()); @@ -1195,7 +1123,7 @@ public void testDelete() { } @Test - public void testKeyFactory() { + void testKeyFactory() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(KIND1); assertEquals(INCOMPLETE_KEY1, keyFactory.newKey()); assertEquals( @@ -1206,7 +1134,7 @@ public void testKeyFactory() { } @Test - public void testRetryableException() { + void testRetryableException() { LookupRequest requestPb = LookupRequest.newBuilder().setProjectId(PROJECT_ID).addKeys(KEY1.toPb()).build(); LookupResponse responsePb = @@ -1214,6 +1142,7 @@ public void testRetryableException() { .addFound(EntityResult.newBuilder().setEntity(ENTITY1.toPb())) .build(); EasyMock.expect(rpcMock.lookup(requestPb)) + .andReturn(LookupResponse.newBuilder().build()) .andThrow(new DatastoreException(14, "UNAVAILABLE", "UNAVAILABLE", null)) .andReturn(responsePb); EasyMock.replay(rpcFactoryMock, rpcMock); @@ -1224,7 +1153,7 @@ public void testRetryableException() { } @Test - public void testRetryableExceptionForOperationWithTxn() { + void testRetryableExceptionForOperationWithTxn() { ByteString txnBytes = ByteString.copyFromUtf8("txn1"); LookupRequest requestPb = LookupRequest.newBuilder() @@ -1250,7 +1179,7 @@ public void testRetryableExceptionForOperationWithTxn() { } @Test - public void testNonRetryableExceptionForOperationWithTxn() { + void testNonRetryableExceptionForOperationWithTxn() { ByteString txnBytes = ByteString.copyFromUtf8("txn1"); LookupRequest requestPb = LookupRequest.newBuilder() @@ -1264,19 +1193,19 @@ public void testNonRetryableExceptionForOperationWithTxn() { .andThrow(new DatastoreException(10, "ABORTED", "ABORTED", null)) .times(1); EasyMock.replay(rpcFactoryMock, rpcMock); - try { - Datastore datastore = rpcMockOptions.getService(); - Transaction transaction = datastore.newTransaction(); - transaction.get(KEY1); - Assert.fail(); - EasyMock.verify(rpcFactoryMock, rpcMock); - } catch (DatastoreException ex) { - assertEquals("ABORTED", ex.getMessage()); - } + DatastoreException ex = + assertThrows( + DatastoreException.class, + () -> { + Datastore datastore = rpcMockOptions.getService(); + Transaction transaction = datastore.newTransaction(); + transaction.get(KEY1); + }); + assertEquals("ABORTED", ex.getMessage()); } @Test - public void testNonRetryableException() { + void testNonRetryableException() { LookupRequest requestPb = LookupRequest.newBuilder().setProjectId(PROJECT_ID).addKeys(KEY1.toPb()).build(); EasyMock.expect(rpcMock.lookup(requestPb)) @@ -1284,35 +1213,35 @@ public void testNonRetryableException() { new DatastoreException(DatastoreException.UNKNOWN_CODE, "denied", "PERMISSION_DENIED")) .times(1); EasyMock.replay(rpcFactoryMock, rpcMock); - try { - Datastore datastore = rpcMockOptions.getService(); - datastore.get(KEY1); - Assert.fail(); - EasyMock.verify(rpcFactoryMock, rpcMock); - } catch (DatastoreException ex) { - assertEquals("denied", ex.getMessage()); - } + DatastoreException ex = + assertThrows( + DatastoreException.class, + () -> { + Datastore datastore = rpcMockOptions.getService(); + datastore.get(KEY1); + }); + assertEquals("denied", ex.getMessage()); } @Test - public void testRuntimeException() { + void testRuntimeException() { LookupRequest requestPb = LookupRequest.newBuilder().setProjectId(PROJECT_ID).addKeys(KEY1.toPb()).build(); String exceptionMessage = "Artificial runtime exception"; EasyMock.expect(rpcMock.lookup(requestPb)).andThrow(new RuntimeException(exceptionMessage)); EasyMock.replay(rpcFactoryMock, rpcMock); - try { - Datastore datastore = rpcMockOptions.getService(); - datastore.get(KEY1); - Assert.fail(); - EasyMock.verify(rpcFactoryMock, rpcMock); - } catch (DatastoreException ex) { - assertEquals(exceptionMessage, ex.getCause().getMessage()); - } + DatastoreException ex = + assertThrows( + DatastoreException.class, + () -> { + Datastore datastore = rpcMockOptions.getService(); + datastore.get(KEY1); + }); + assertEquals(exceptionMessage, ex.getCause().getMessage()); } @Test - public void testGqlQueryWithNullBinding() { + void testGqlQueryWithNullBinding() { Query query = Query.newGqlQueryBuilder(ResultType.ENTITY, "select * from " + KIND1) .setNullBinding("name") @@ -1336,7 +1265,7 @@ public void testGqlQueryWithNullBinding() { } @Test - public void testQueryWithStartCursor() { + void testQueryWithStartCursor() { Entity entity1 = Entity.newBuilder(Key.newBuilder(PROJECT_ID, KIND1, "name-01").build()).build(); Entity entity2 = @@ -1357,7 +1286,7 @@ public void testQueryWithStartCursor() { } @Test - public void testDatabaseIdKeyFactory() { + void testDatabaseIdKeyFactory() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(KIND1); Key key1 = keyFactory.newKey("key1"); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationQueryTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationQueryTest.java index fd037808c..7dfe951a0 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationQueryTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationQueryTest.java @@ -22,16 +22,16 @@ import static com.google.cloud.datastore.aggregation.Aggregation.count; import static com.google.cloud.datastore.aggregation.Aggregation.sum; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.cloud.datastore.aggregation.AvgAggregation; import com.google.cloud.datastore.aggregation.CountAggregation; import com.google.cloud.datastore.aggregation.SumAggregation; import com.google.common.collect.ImmutableSet; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class AggregationQueryTest { +class AggregationQueryTest { private static final String KIND = "Task"; private static final String NAMESPACE = "ns"; @@ -44,7 +44,7 @@ public class AggregationQueryTest { .build(); @Test - public void testAggregations() { + void testAggregations() { AggregationQuery aggregationQuery = Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) @@ -60,7 +60,7 @@ public void testAggregations() { } @Test - public void testAggregationBuilderWithMultipleAggregationsOneByOne() { + void testAggregationBuilderWithMultipleAggregationsOneByOne() { AggregationQuery aggregationQuery = Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) @@ -79,7 +79,7 @@ public void testAggregationBuilderWithMultipleAggregationsOneByOne() { } @Test - public void testAggregationBuilderWithMultipleAggregationsTogether() { + void testAggregationBuilderWithMultipleAggregationsTogether() { AggregationQuery aggregationQuery = Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) @@ -97,7 +97,7 @@ public void testAggregationBuilderWithMultipleAggregationsTogether() { } @Test - public void testAggregationBuilderWithMultipleAggregationsConfiguredThroughConstructor() { + void testAggregationBuilderWithMultipleAggregationsConfiguredThroughConstructor() { AggregationQuery aggregationQuery = Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) @@ -117,7 +117,7 @@ public void testAggregationBuilderWithMultipleAggregationsConfiguredThroughConst } @Test - public void testAggregationBuilderWithDuplicateAggregations() { + void testAggregationBuilderWithDuplicateAggregations() { AggregationQuery aggregationQueryWithDuplicateCounts = Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) @@ -149,7 +149,7 @@ public void testAggregationBuilderWithDuplicateAggregations() { } @Test - public void testAggregationQueryBuilderWithoutNamespace() { + void testAggregationQueryBuilderWithoutNamespace() { AggregationQuery aggregationQuery = Query.newAggregationQueryBuilder() .addAggregation(count().as("total")) @@ -164,31 +164,31 @@ public void testAggregationQueryBuilderWithoutNamespace() { } @Test - public void testAggregationQueryBuilderWithoutNestedQuery() { + void testAggregationQueryBuilderWithoutNestedQuery() { assertThrows( - "Nested query is required for an aggregation query to run", IllegalArgumentException.class, () -> Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) .addAggregation(count().as("total")) - .build()); + .build(), + "Nested query is required for an aggregation query to run"); } @Test - public void testAggregationQueryBuilderWithoutAggregation() { + void testAggregationQueryBuilderWithoutAggregation() { assertThrows( - "At least one aggregation is required for an aggregation query to run", IllegalArgumentException.class, () -> Query.newAggregationQueryBuilder() .setNamespace(NAMESPACE) .over(COMPLETED_TASK_QUERY) - .build()); + .build(), + "At least one aggregation is required for an aggregation query to run"); } @Test - public void testAggregationQueryBuilderWithGqlQuery() { + void testAggregationQueryBuilderWithGqlQuery() { GqlQuery gqlQuery = Query.newGqlQueryBuilder("SELECT * FROM Task WHERE done = true").build(); AggregationQuery aggregationQuery = @@ -199,10 +199,10 @@ public void testAggregationQueryBuilderWithGqlQuery() { } @Test - public void testAggregationQueryBuilderWithoutProvidingAnyNestedQuery() { + void testAggregationQueryBuilderWithoutProvidingAnyNestedQuery() { assertThrows( - "Nested query is required for an aggregation query to run", IllegalArgumentException.class, - () -> Query.newAggregationQueryBuilder().setNamespace(NAMESPACE).build()); + () -> Query.newAggregationQueryBuilder().setNamespace(NAMESPACE).build(), + "Nested query is required for an aggregation query to run"); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationResultTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationResultTest.java index 84341f9d4..24f6e763c 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationResultTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/AggregationResultTest.java @@ -16,15 +16,15 @@ package com.google.cloud.datastore; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class AggregationResultTest { +class AggregationResultTest { @Test - public void shouldGetLongAggregatedResultValueByAlias() { + void shouldGetLongAggregatedResultValueByAlias() { AggregationResult aggregationResult = new AggregationResult( ImmutableMap.of( @@ -36,7 +36,7 @@ public void shouldGetLongAggregatedResultValueByAlias() { } @Test - public void shouldGetDoubleAggregatedResultValueByAlias() { + void shouldGetDoubleAggregatedResultValueByAlias() { AggregationResult aggregationResult = new AggregationResult( ImmutableMap.of( @@ -48,7 +48,7 @@ public void shouldGetDoubleAggregatedResultValueByAlias() { } @Test - public void shouldGetLongAggregatedResultValueAsDouble() { + void shouldGetLongAggregatedResultValueAsDouble() { AggregationResult aggregationResult = new AggregationResult(ImmutableMap.of("count", LongValue.of(45))); @@ -56,7 +56,7 @@ public void shouldGetLongAggregatedResultValueAsDouble() { } @Test - public void shouldGetDoubleAggregatedResultValueAsLong() { + void shouldGetDoubleAggregatedResultValueAsLong() { AggregationResult aggregationResult = new AggregationResult(ImmutableMap.of("qty_avg", DoubleValue.of(45.9322))); @@ -64,7 +64,7 @@ public void shouldGetDoubleAggregatedResultValueAsLong() { } @Test - public void shouldThrowRuntimeExceptionOnUnknownTypes() { + void shouldThrowRuntimeExceptionOnUnknownTypes() { AggregationResult aggregationResult = new AggregationResult( ImmutableMap.of( @@ -84,14 +84,14 @@ public void shouldThrowRuntimeExceptionOnUnknownTypes() { } @Test - public void shouldGetDoubleAggregatedResultValueAsNumber() { + void shouldGetDoubleAggregatedResultValueAsNumber() { AggregationResult aggregationResult = new AggregationResult(ImmutableMap.of("qty_avg", DoubleValue.of(45.9322))); assertThat(aggregationResult.getNumber("qty_avg")).isEqualTo(45.9322); } @Test - public void shouldGetLongAggregatedResultValueAsNumber() { + void shouldGetLongAggregatedResultValueAsNumber() { AggregationResult aggregationResult = new AggregationResult(ImmutableMap.of("count", LongValue.of(50))); assertThat(aggregationResult.getNumber("count")).isEqualTo(50); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java index 6c8d7c057..54e001a0f 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java @@ -19,17 +19,18 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.collect.ImmutableList; import java.util.LinkedList; import java.util.List; import org.easymock.EasyMock; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class BaseDatastoreBatchWriterTest { +class BaseDatastoreBatchWriterTest { private static final Key KEY1 = Key.newBuilder("dataset1", "kind1", "name1").build(); private static final Key KEY2 = Key.newBuilder(KEY1, 1).build(); @@ -68,18 +69,18 @@ void finish() { } } - @Before - public void setUp() { + @BeforeEach + void setUp() { batchWriter = new DatastoreBatchWriter(); } - @After - public void tearDown() { + @AfterEach + void tearDown() { batchWriter.finish(); } @Test - public void testAdd() { + void testAdd() { Entity entity2 = Entity.newBuilder(ENTITY2).setKey(Key.newBuilder(KEY1).setName("name2").build()).build(); List pbs = new LinkedList<>(); @@ -103,7 +104,7 @@ public void testAdd() { } @Test - public void testAddAfterDelete() { + void testAddAfterDelete() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY1.toPb()).build()); batchWriter.delete(KEY1); @@ -111,32 +112,48 @@ public void testAddAfterDelete() { assertEquals(pbs, batchWriter.toMutationPbList()); } - @Test(expected = DatastoreException.class) - public void testAddDuplicate() { - batchWriter.add(ENTITY1); - batchWriter.add(ENTITY1); + @Test + void testAddDuplicate() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.add(ENTITY1); + batchWriter.add(ENTITY1); + }); } - @Test(expected = DatastoreException.class) - public void testAddAfterPut() { - batchWriter.put(ENTITY1); - batchWriter.add(ENTITY1); + @Test + void testAddAfterPut() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.put(ENTITY1); + batchWriter.add(ENTITY1); + }); } - @Test(expected = DatastoreException.class) - public void testAddAfterUpdate() { - batchWriter.update(ENTITY1); - batchWriter.add(ENTITY1); + @Test + void testAddAfterUpdate() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.update(ENTITY1); + batchWriter.add(ENTITY1); + }); } - @Test(expected = DatastoreException.class) - public void testAddWhenNotActive() { - batchWriter.deactivate(); - batchWriter.add(ENTITY1); + @Test + void testAddWhenNotActive() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.deactivate(); + batchWriter.add(ENTITY1); + }); } @Test - public void testAddWithDeferredAllocation() { + void testAddWithDeferredAllocation() { List pbs = new LinkedList<>(); pbs.add( com.google.datastore.v1.Mutation.newBuilder() @@ -152,14 +169,18 @@ public void testAddWithDeferredAllocation() { assertEquals(pbs, batchWriter.toMutationPbList()); } - @Test(expected = DatastoreException.class) - public void testAddWithDeferredAllocationWhenNotActive() { - batchWriter.deactivate(); - batchWriter.addWithDeferredIdAllocation(INCOMPLETE_ENTITY_1); + @Test + void testAddWithDeferredAllocationWhenNotActive() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.deactivate(); + batchWriter.addWithDeferredIdAllocation(INCOMPLETE_ENTITY_1); + }); } @Test - public void testUpdate() { + void testUpdate() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpdate(ENTITY1.toPb()).build()); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpdate(ENTITY2.toPb()).build()); @@ -170,7 +191,7 @@ public void testUpdate() { } @Test - public void testUpdateAfterUpdate() { + void testUpdateAfterUpdate() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpdate(entity.toPb()).build()); @@ -180,7 +201,7 @@ public void testUpdateAfterUpdate() { } @Test - public void testUpdateAfterAdd() { + void testUpdateAfterAdd() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build()); @@ -190,7 +211,7 @@ public void testUpdateAfterAdd() { } @Test - public void testUpdateAfterPut() { + void testUpdateAfterPut() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build()); @@ -199,20 +220,28 @@ public void testUpdateAfterPut() { assertEquals(pbs, batchWriter.toMutationPbList()); } - @Test(expected = DatastoreException.class) - public void testUpdateAfterDelete() { - batchWriter.delete(KEY1); - batchWriter.update(ENTITY1, ENTITY2); + @Test + void testUpdateAfterDelete() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.delete(KEY1); + batchWriter.update(ENTITY1, ENTITY2); + }); } - @Test(expected = DatastoreException.class) - public void testUpdateWhenNotActive() { - batchWriter.deactivate(); - batchWriter.update(ENTITY1); + @Test + void testUpdateWhenNotActive() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.deactivate(); + batchWriter.update(ENTITY1); + }); } @Test - public void testPut() { + void testPut() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY1.toPb()).build()); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY2.toPb()).build()); @@ -226,7 +255,7 @@ public void testPut() { } @Test - public void testPutIncompleteKey() { + void testPutIncompleteKey() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(ENTITY1.toPb()).build()); pbs.add( @@ -246,7 +275,7 @@ public void testPutIncompleteKey() { } @Test - public void testPutWithDeferredAllocation() { + void testPutWithDeferredAllocation() { List pbs = new LinkedList<>(); pbs.add( com.google.datastore.v1.Mutation.newBuilder() @@ -263,7 +292,7 @@ public void testPutWithDeferredAllocation() { } @Test - public void testPutAfterPut() { + void testPutAfterPut() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build()); @@ -275,7 +304,7 @@ public void testPutAfterPut() { } @Test - public void testPutAfterAdd() { + void testPutAfterAdd() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build()); @@ -285,7 +314,7 @@ public void testPutAfterAdd() { } @Test - public void testPutAfterUpdate() { + void testPutAfterUpdate() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build()); @@ -296,7 +325,7 @@ public void testPutAfterUpdate() { } @Test - public void testPutAfterDelete() { + void testPutAfterDelete() { Entity entity = Entity.newBuilder(ENTITY1).set("foo", "bar").build(); List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setUpsert(entity.toPb()).build()); @@ -306,14 +335,18 @@ public void testPutAfterDelete() { assertEquals(pbs, batchWriter.toMutationPbList()); } - @Test(expected = DatastoreException.class) - public void testPutWhenNotActive() { - batchWriter.deactivate(); - batchWriter.put(ENTITY1); + @Test + void testPutWhenNotActive() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.deactivate(); + batchWriter.put(ENTITY1); + }); } @Test - public void testDelete() { + void testDelete() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY1.toPb()).build()); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY2.toPb()).build()); @@ -324,7 +357,7 @@ public void testDelete() { } @Test - public void testDeleteAfterAdd() { + void testDeleteAfterAdd() { List pbs = new LinkedList<>(); pbs.add( com.google.datastore.v1.Mutation.newBuilder() @@ -338,7 +371,7 @@ public void testDeleteAfterAdd() { } @Test - public void testDeleteAfterUpdate() { + void testDeleteAfterUpdate() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY1.toPb()).build()); batchWriter.update(ENTITY1); @@ -347,7 +380,7 @@ public void testDeleteAfterUpdate() { } @Test - public void testDeleteAfterPut() { + void testDeleteAfterPut() { List pbs = new LinkedList<>(); pbs.add(com.google.datastore.v1.Mutation.newBuilder().setDelete(KEY1.toPb()).build()); batchWriter.put(ENTITY1); @@ -355,9 +388,13 @@ public void testDeleteAfterPut() { assertEquals(pbs, batchWriter.toMutationPbList()); } - @Test(expected = DatastoreException.class) - public void testDeleteWhenNotActive() { - batchWriter.deactivate(); - batchWriter.delete(KEY1); + @Test + void testDeleteWhenNotActive() { + assertThrows( + DatastoreException.class, + () -> { + batchWriter.deactivate(); + batchWriter.delete(KEY1); + }); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java index 1b5380ab9..b4bd18c66 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java @@ -16,9 +16,10 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.Timestamp; import com.google.common.collect.ImmutableList; @@ -27,10 +28,10 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class BaseEntityTest { +class BaseEntityTest { private static final Blob BLOB = Blob.copyFrom(new byte[] {1, 2}); private static final Timestamp TIMESTAMP = Timestamp.now(); @@ -52,8 +53,8 @@ public BaseEntity build() { } } - @Before - public void setUp() { + @BeforeEach + void setUp() { builder = new Builder(); builder.set("blob", BLOB).set("boolean", true).set("timestamp", TIMESTAMP); builder.set("double", 1.25).set("key", KEY).set("string", "hello world"); @@ -79,7 +80,7 @@ public void setUp() { } @Test - public void testContains() { + void testContains() { BaseEntity entity = builder.build(); assertTrue(entity.contains("list1")); assertFalse(entity.contains("bla")); @@ -88,19 +89,23 @@ public void testContains() { } @Test - public void testGetValue() { + void testGetValue() { BaseEntity entity = builder.build(); assertEquals(BlobValue.of(BLOB), entity.getValue("blob")); } - @Test(expected = DatastoreException.class) - public void testGetValueNotFound() { - BaseEntity entity = builder.clear().build(); - entity.getValue("blob"); + @Test + void testGetValueNotFound() { + assertThrows( + DatastoreException.class, + () -> { + BaseEntity entity = builder.clear().build(); + entity.getValue("blob"); + }); } @Test - public void testIsNull() { + void testIsNull() { BaseEntity entity = builder.build(); assertTrue(entity.isNull("null")); assertFalse(entity.isNull("blob")); @@ -108,14 +113,18 @@ public void testIsNull() { assertTrue(entity.isNull("blob")); } - @Test(expected = DatastoreException.class) - public void testIsNullNotFound() { - BaseEntity entity = builder.clear().build(); - entity.isNull("null"); + @Test + void testIsNullNotFound() { + assertThrows( + DatastoreException.class, + () -> { + BaseEntity entity = builder.clear().build(); + entity.isNull("null"); + }); } @Test - public void testGetString() { + void testGetString() { BaseEntity entity = builder.build(); assertEquals("hello world", entity.getString("string")); assertEquals("bla", entity.getString("stringValue")); @@ -124,7 +133,7 @@ public void testGetString() { } @Test - public void testGetLong() { + void testGetLong() { BaseEntity entity = builder.build(); assertEquals(125, entity.getLong("long")); entity = builder.set("long", LongValue.of(10)).build(); @@ -132,7 +141,7 @@ public void testGetLong() { } @Test - public void testGetDouble() { + void testGetDouble() { BaseEntity entity = builder.build(); assertEquals(1.25, entity.getDouble("double"), 0); entity = builder.set("double", DoubleValue.of(10)).build(); @@ -140,7 +149,7 @@ public void testGetDouble() { } @Test - public void testGetBoolean() throws Exception { + void testGetBoolean() throws Exception { BaseEntity entity = builder.build(); assertTrue(entity.getBoolean("boolean")); entity = builder.set("boolean", BooleanValue.of(false)).build(); @@ -148,7 +157,7 @@ public void testGetBoolean() throws Exception { } @Test - public void testGetTimestamp() { + void testGetTimestamp() { BaseEntity entity = builder.build(); assertEquals(TIMESTAMP, entity.getTimestamp("timestamp")); Calendar cal = Calendar.getInstance(); @@ -159,13 +168,13 @@ public void testGetTimestamp() { } @Test - public void testGetLatLng() { + void testGetLatLng() { BaseEntity entity = builder.build(); assertEquals(LAT_LNG, entity.getLatLng("latLng")); } @Test - public void testGetKey() { + void testGetKey() { BaseEntity entity = builder.build(); assertEquals(KEY, entity.getKey("key")); Key key = Key.newBuilder(KEY).setName("BLA").build(); @@ -174,7 +183,7 @@ public void testGetKey() { } @Test - public void testGetEntity() { + void testGetEntity() { BaseEntity entity = builder.build(); assertEquals(ENTITY, entity.getEntity("entity")); assertEquals(PARTIAL_ENTITY, entity.getEntity("partialEntity")); @@ -183,7 +192,7 @@ public void testGetEntity() { } @Test - public void testGetList() { + void testGetList() { BaseEntity entity = builder.build(); List> list = entity.getList("list1"); assertEquals(3, list.size()); @@ -213,7 +222,7 @@ public void testGetList() { } @Test - public void testGetBlob() { + void testGetBlob() { BaseEntity entity = builder.build(); assertEquals(BLOB, entity.getBlob("blob")); Blob blob = Blob.copyFrom(new byte[] {}); @@ -222,7 +231,7 @@ public void testGetBlob() { } @Test - public void testNames() { + void testNames() { Set names = ImmutableSet.builder() .add("string", "stringValue", "boolean", "double", "long", "list1", "list2", "list3") @@ -236,7 +245,7 @@ public void testNames() { } @Test - public void testKey() { + void testKey() { builder.setKey(KEY); BaseEntity entity = builder.build(); assertEquals(KEY, entity.getKey()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java index 08b65bdc7..b68ce7b1a 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java @@ -16,15 +16,16 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class BaseKeyTest { +class BaseKeyTest { private class Builder extends BaseKey.Builder { @@ -56,7 +57,7 @@ protected BaseKey getParent() { } @Test - public void testProjectId() { + void testProjectId() { Builder builder = new Builder("ds1", "k"); BaseKey key = builder.build(); assertEquals("ds1", key.getProjectId()); @@ -66,7 +67,7 @@ public void testProjectId() { } @Test - public void testDatabaseId() { + void testDatabaseId() { Builder builder = new Builder("ds1", "k").setDatabaseId("test-db"); BaseKey key = builder.build(); assertEquals("ds1", key.getProjectId()); @@ -75,19 +76,23 @@ public void testDatabaseId() { assertEquals("test-db", key.getDatabaseId()); } - @Test(expected = IllegalArgumentException.class) - public void testBadDatasetInConstructor() { - new Builder(" ", "k"); + @Test + void testBadDatasetInConstructor() { + assertThrows(IllegalArgumentException.class, () -> new Builder(" ", "k")); } - @Test(expected = IllegalArgumentException.class) - public void testBadDatasetInSetter() { - Builder builder = new Builder("d", "k"); - builder.setProjectId(" "); + @Test + void testBadDatasetInSetter() { + assertThrows( + IllegalArgumentException.class, + () -> { + Builder builder = new Builder("d", "k"); + builder.setProjectId(" "); + }); } @Test - public void testNamespace() { + void testNamespace() { Builder builder = new Builder("ds", "k"); BaseKey key = builder.build(); assertTrue(key.getNamespace() != null); @@ -97,7 +102,7 @@ public void testNamespace() { } @Test - public void testKind() { + void testKind() { Builder builder = new Builder("ds", "k1"); BaseKey key = builder.build(); assertEquals("k1", key.getKind()); @@ -105,25 +110,33 @@ public void testKind() { assertEquals("k2", key.getKind()); } - @Test(expected = NullPointerException.class) - public void testNoKind() throws Exception { - Builder builder = new Builder("ds"); - builder.build(); + @Test + void testNoKind() throws Exception { + assertThrows( + NullPointerException.class, + () -> { + Builder builder = new Builder("ds"); + builder.build(); + }); } - @Test(expected = IllegalArgumentException.class) - public void testBadKindInConstructor() throws Exception { - new Builder("ds", ""); + @Test + void testBadKindInConstructor() throws Exception { + assertThrows(IllegalArgumentException.class, () -> new Builder("ds", "")); } - @Test(expected = IllegalArgumentException.class) - public void testBadKindInSetter() throws Exception { - Builder builder = new Builder("ds", "k1"); - builder.setKind(""); + @Test + void testBadKindInSetter() throws Exception { + assertThrows( + IllegalArgumentException.class, + () -> { + Builder builder = new Builder("ds", "k1"); + builder.setKind(""); + }); } @Test - public void testAncestors() throws Exception { + void testAncestors() throws Exception { Builder builder = new Builder("ds", "k"); BaseKey key = builder.build(); assertTrue(key.getAncestors().isEmpty()); @@ -137,7 +150,7 @@ public void testAncestors() throws Exception { } @Test - public void testCopyFrom() { + void testCopyFrom() { Builder copyFrom = new Builder("test-project", "kind").setDatabaseId("test-db"); Builder builder = new Builder(copyFrom.build()); BaseKey baseKey = builder.build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java index 391f6f765..071a4520d 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java @@ -16,28 +16,28 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; +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.assertNotEquals; import com.google.common.testing.EqualsTester; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.Random; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class BlobTest { +class BlobTest { private static final byte[] bytes1 = new byte[10]; private static final byte[] bytes2 = new byte[11]; private Blob blob1; private Blob blob2; - @Before - public void setUp() { + @BeforeEach + void setUp() { Random rnd = new Random(); rnd.nextBytes(bytes1); rnd.nextBytes(bytes2); @@ -46,7 +46,7 @@ public void setUp() { } @Test - public void testEquals() { + void testEquals() { EqualsTester equalsTester = new EqualsTester(); equalsTester.addEqualityGroup(blob1, blob1).testEquals(); assertEquals(blob1, Blob.copyFrom(bytes1)); @@ -54,19 +54,19 @@ public void testEquals() { } @Test - public void testLength() { + void testLength() { assertEquals(bytes1.length, blob1.getLength()); assertEquals(bytes2.length, blob2.getLength()); } @Test - public void testToByteArray() { + void testToByteArray() { assertArrayEquals(bytes1, blob1.toByteArray()); assertArrayEquals(bytes2, blob2.toByteArray()); } @Test - public void testAsReadOnlyByteBuffer() { + void testAsReadOnlyByteBuffer() { ByteBuffer buffer = blob1.asReadOnlyByteBuffer(); byte[] bytes = new byte[bytes1.length]; buffer.get(bytes); @@ -75,7 +75,7 @@ public void testAsReadOnlyByteBuffer() { } @Test - public void testAsInputStream() throws Exception { + void testAsInputStream() throws Exception { byte[] bytes = new byte[bytes1.length]; InputStream in = blob1.asInputStream(); assertEquals(bytes1.length, in.read(bytes)); @@ -84,7 +84,7 @@ public void testAsInputStream() throws Exception { } @Test - public void testCopyTo() { + void testCopyTo() { byte[] bytes = new byte[bytes1.length]; blob1.copyTo(bytes); assertArrayEquals(bytes1, bytes); @@ -99,7 +99,7 @@ public void testCopyTo() { } @Test - public void testCopyFrom() throws Exception { + void testCopyFrom() throws Exception { Blob blob = Blob.copyFrom(ByteBuffer.wrap(bytes1)); assertEquals(blob1, blob); assertArrayEquals(bytes1, blob.toByteArray()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java index 7bad94293..0c73b0381 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java @@ -16,24 +16,24 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class BlobValueTest { +class BlobValueTest { private static final Blob CONTENT = Blob.copyFrom(new byte[] {1, 2}); @Test - public void testToBuilder() { + void testToBuilder() { BlobValue value = BlobValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { BlobValue value = BlobValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -41,7 +41,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { BlobValue.Builder builder = BlobValue.newBuilder(CONTENT); BlobValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java index 579c17748..e7a265fc4 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java @@ -16,22 +16,22 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class BooleanValueTest { +class BooleanValueTest { @Test - public void testToBuilder() { + void testToBuilder() { BooleanValue value = BooleanValue.of(true); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { BooleanValue value = BooleanValue.of(false); assertFalse(value.get()); assertFalse(value.excludeFromIndexes()); @@ -39,7 +39,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { BooleanValue.Builder builder = BooleanValue.newBuilder(true); BooleanValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertTrue(value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java index 4a3c3542d..8a9ebadab 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java @@ -16,34 +16,34 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import com.google.protobuf.ByteString; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class CursorTest { +class CursorTest { private static final byte[] bytes1 = {1, 2, 3, '%', '<', '+'}; private static final byte[] bytes2 = {10, 20, 30}; private Cursor cursor1; private Cursor cursor2; - @Before - public void setUp() { + @BeforeEach + void setUp() { cursor1 = new Cursor(ByteString.copyFrom(bytes1)); cursor2 = new Cursor(ByteString.copyFrom(bytes2)); } @Test - public void testToFromUrlSafe() { + void testToFromUrlSafe() { String urlSafe = cursor1.toUrlSafe(); assertEquals(cursor1, Cursor.fromUrlSafe(urlSafe)); } @Test - public void testCopyFrom() { + void testCopyFrom() { Cursor cursor = Cursor.copyFrom(bytes2); assertEquals(cursor2, cursor); assertNotEquals(cursor1, cursor); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java index 8c52b5519..bf71518b9 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java @@ -20,23 +20,23 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; -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.Assert.fail; +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.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.BaseServiceException; import com.google.cloud.RetryHelper; import java.io.IOException; import java.net.SocketTimeoutException; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class DatastoreExceptionTest { +class DatastoreExceptionTest { @Test - public void testDatastoreException() { + void testDatastoreException() { DatastoreException exception = new DatastoreException(10, "message", "ABORTED"); assertEquals(10, exception.getCode()); assertEquals("ABORTED", exception.getReason()); @@ -79,7 +79,7 @@ public void testDatastoreException() { } @Test - public void testTranslateAndThrow() { + void testTranslateAndThrow() { Exception cause = new DatastoreException(14, "message", "UNAVAILABLE"); RetryHelper.RetryHelperException exceptionMock = createMock(RetryHelper.RetryHelperException.class); @@ -112,13 +112,12 @@ public void testTranslateAndThrow() { } @Test - public void testThrowInvalidRequest() { - try { - DatastoreException.throwInvalidRequest("message %s %d", "a", 1); - fail("Exception expected"); - } catch (DatastoreException ex) { - assertEquals("FAILED_PRECONDITION", ex.getReason()); - assertEquals("message a 1", ex.getMessage()); - } + void testThrowInvalidRequest() { + DatastoreException exception = + assertThrows( + DatastoreException.class, + () -> DatastoreException.throwInvalidRequest("message %s %d", "a", 1)); + assertEquals("FAILED_PRECONDITION", exception.getReason()); + assertEquals("message a 1", exception.getMessage()); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java index 010a892ae..b965cda90 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java @@ -21,19 +21,19 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class DatastoreHelperTest { +class DatastoreHelperTest { @Test - public void testNewKeyFactory() { + void testNewKeyFactory() { DatastoreOptions options = createMock(DatastoreOptions.class); expect(options.getProjectId()).andReturn("ds1").once(); expect(options.getNamespace()).andReturn("ns1").once(); @@ -50,7 +50,7 @@ public void testNewKeyFactory() { } @Test - public void testAllocateId() { + void testAllocateId() { Datastore datastore = createStrictMock(Datastore.class); IncompleteKey pKey1 = IncompleteKey.newBuilder("ds", "k").build(); Key key1 = Key.newBuilder(pKey1, 1).build(); @@ -62,7 +62,7 @@ public void testAllocateId() { } @Test - public void testGetWithDatastore() throws Exception { + void testGetWithDatastore() throws Exception { Datastore datastore = createStrictMock(Datastore.class); IncompleteKey pKey1 = IncompleteKey.newBuilder("ds", "k").build(); Key key1 = Key.newBuilder(pKey1, 1).build(); @@ -83,7 +83,7 @@ public void testGetWithDatastore() throws Exception { } @Test - public void testGetWithTransaction() throws Exception { + void testGetWithTransaction() throws Exception { Transaction transaction = createStrictMock(Transaction.class); IncompleteKey pKey1 = IncompleteKey.newBuilder("ds", "k").build(); Key key1 = Key.newBuilder(pKey1, 1).build(); @@ -99,7 +99,7 @@ public void testGetWithTransaction() throws Exception { } @Test - public void testAdd() throws Exception { + void testAdd() throws Exception { Datastore datastore = createStrictMock(Datastore.class); IncompleteKey pKey = IncompleteKey.newBuilder("ds", "k").build(); Key key = Key.newBuilder(pKey, 1).build(); @@ -111,7 +111,7 @@ public void testAdd() throws Exception { } @Test - public void testFetchWithDatastore() throws Exception { + void testFetchWithDatastore() throws Exception { Datastore datastore = createStrictMock(Datastore.class); IncompleteKey pKey1 = IncompleteKey.newBuilder("ds", "k").build(); Key key1 = Key.newBuilder(pKey1, 1).build(); @@ -138,7 +138,7 @@ public void testFetchWithDatastore() throws Exception { } @Test - public void testFetchWithTransaction() throws Exception { + void testFetchWithTransaction() throws Exception { Transaction transaction = createStrictMock(Transaction.class); IncompleteKey pKey1 = IncompleteKey.newBuilder("ds", "k").build(); Key key1 = Key.newBuilder(pKey1, 1).build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java index 0c25c3b6c..4dcd3bd6d 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java @@ -17,10 +17,10 @@ package com.google.cloud.datastore; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -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.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.api.gax.grpc.ChannelPoolSettings; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; @@ -32,11 +32,10 @@ import com.google.cloud.http.HttpTransportOptions; import com.google.datastore.v1.client.DatastoreFactory; import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class DatastoreOptionsTest { +class DatastoreOptionsTest { private static final String PROJECT_ID = "project-id"; private static final String DATABASE_ID = "database-id"; @@ -46,8 +45,8 @@ public class DatastoreOptionsTest { private DatastoreRpc datastoreRpc; private DatastoreOptions.Builder options; - @Before - public void setUp() { + @BeforeEach + void setUp() { datastoreRpcFactory = EasyMock.createMock(DatastoreRpcFactory.class); datastoreRpc = EasyMock.createMock(DatastoreRpc.class); options = @@ -65,47 +64,47 @@ public void setUp() { } @Test - public void testProjectId() { + void testProjectId() { assertEquals(PROJECT_ID, options.build().getProjectId()); } @Test - public void testDatabaseId() { + void testDatabaseId() { assertEquals(DATABASE_ID, options.build().getDatabaseId()); } @Test - public void testHost() { + void testHost() { assertEquals("http://localhost:" + PORT, options.build().getHost()); } @Test - public void testOpenTelemetryOptionsEnabled() { + void testOpenTelemetryOptionsEnabled() { options.setOpenTelemetryOptions( DatastoreOpenTelemetryOptions.newBuilder().setTracingEnabled(true).build()); assertTrue(options.build().getOpenTelemetryOptions().isEnabled()); } @Test - public void testOpenTelemetryOptionsDisabled() { + void testOpenTelemetryOptionsDisabled() { options.setOpenTelemetryOptions( DatastoreOpenTelemetryOptions.newBuilder().setTracingEnabled(false).build()); assertTrue(!options.build().getOpenTelemetryOptions().isEnabled()); } @Test - public void testNamespace() { + void testNamespace() { assertTrue(options.build().getNamespace().isEmpty()); assertEquals("ns1", options.setNamespace("ns1").build().getNamespace()); } @Test - public void testDatastore() { + void testDatastore() { assertSame(datastoreRpc, options.build().getRpc()); } @Test - public void testGrpcDefaultChannelConfigurations() { + void testGrpcDefaultChannelConfigurations() { DatastoreOptions datastoreOptions = DatastoreOptions.newBuilder() .setServiceRpcFactory(datastoreRpcFactory) @@ -124,7 +123,7 @@ public void testGrpcDefaultChannelConfigurations() { } @Test - public void testCustomChannelAndCredentials() { + void testCustomChannelAndCredentials() { InstantiatingGrpcChannelProvider channelProvider = DatastoreSettings.defaultGrpcTransportProviderBuilder() .setChannelPoolSettings( @@ -147,7 +146,7 @@ public void testCustomChannelAndCredentials() { } @Test - public void testInvalidConfigForHttp() { + void testInvalidConfigForHttp() { DatastoreOptions.Builder options = DatastoreOptions.newBuilder() .setServiceRpcFactory(datastoreRpcFactory) @@ -164,11 +163,11 @@ public void testInvalidConfigForHttp() { .build()) .setCredentials(NoCredentials.getInstance()) .setHost("http://localhost:" + PORT); - Assert.assertThrows(IllegalArgumentException.class, options::build); + org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, options::build); } @Test - public void testTransport() { + void testTransport() { // default http transport assertThat(options.build().getTransportOptions()).isInstanceOf(HttpTransportOptions.class); @@ -185,7 +184,7 @@ public void testTransport() { } @Test - public void testHostWithGrpcAndHttp() { + void testHostWithGrpcAndHttp() { DatastoreOptions grpcTransportOptions = DatastoreOptions.newBuilder() .setTransportOptions(GrpcTransportOptions.newBuilder().build()) @@ -222,7 +221,7 @@ public void testHostWithGrpcAndHttp() { } @Test - public void testToBuilder() { + void testToBuilder() { DatastoreOptions original = options.setNamespace("ns1").build(); DatastoreOptions copy = original.toBuilder().build(); assertEquals(original.getProjectId(), copy.getProjectId()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java index cb242f2af..1dc5cb891 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestGrpc.java @@ -21,14 +21,10 @@ import com.google.common.truth.Truth; import java.io.IOException; import java.time.Duration; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; -@RunWith(Parameterized.class) -public class DatastoreTestGrpc extends AbstractDatastoreTest { +class DatastoreTestGrpc extends AbstractDatastoreTest { private static final LocalDatastoreHelper helper = LocalDatastoreHelper.create(1.0, 9090); @@ -36,24 +32,15 @@ public class DatastoreTestGrpc extends AbstractDatastoreTest { helper.getGrpcTransportOptions(GrpcTransportOptions.newBuilder().build()); private static Datastore datastore = options.getService(); - public DatastoreTestGrpc(DatastoreOptions options, Datastore datastore) { - super(options, datastore); - } - - @Parameterized.Parameters(name = "data options: {0}") - public static Iterable data() { - return Arrays.asList(new Object[][] {{options, datastore}}); - } - - @BeforeClass - public static void beforeClass() throws IOException, InterruptedException { + @BeforeAll + static void beforeClass() throws IOException, InterruptedException { helper.start(); options = helper.getGrpcTransportOptions(GrpcTransportOptions.newBuilder().build()); datastore = options.getService(); } - @AfterClass - public static void afterClass() throws Exception { + @AfterAll + static void afterClass() throws Exception { datastore.close(); Truth.assertThat(datastore.isClosed()).isTrue(); helper.stopDuration(Duration.ofMinutes(1)); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java index a73cae8e4..b9b9b926f 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreTestHttp.java @@ -20,37 +20,24 @@ import com.google.cloud.grpc.GrpcTransportOptions; import java.io.IOException; import java.time.Duration; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; -@RunWith(Parameterized.class) -public class DatastoreTestHttp extends AbstractDatastoreTest { +class DatastoreTestHttp extends AbstractDatastoreTest { private static final LocalDatastoreHelper helper = LocalDatastoreHelper.create(1.0, 9090); private static DatastoreOptions options = helper.getOptions(); private static Datastore datastore = options.getService(); - public DatastoreTestHttp(DatastoreOptions options, Datastore datastore) { - super(options, datastore); - } - - @Parameterized.Parameters(name = "data options: {0}") - public static Iterable data() { - return Arrays.asList(new Object[][] {{options, datastore}}); - } - - @BeforeClass + @BeforeAll public static void beforeClass() throws IOException, InterruptedException { helper.start(); options = helper.getGrpcTransportOptions(GrpcTransportOptions.newBuilder().build()); datastore = options.getService(); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { helper.stopDuration(Duration.ofMinutes(1)); } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreUtilsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreUtilsTest.java index 74d7e9d28..83ac89212 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreUtilsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreUtilsTest.java @@ -20,12 +20,12 @@ import static com.google.cloud.datastore.DatastoreUtils.removeScheme; import static com.google.common.truth.Truth.assertThat; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class DatastoreUtilsTest { +class DatastoreUtilsTest { @Test - public void testIsLocalHost() { + void testIsLocalHost() { assertThat(isLocalHost(null)).isFalse(); assertThat(isLocalHost("")).isFalse(); assertThat(isLocalHost("http://localhost:9090")).isTrue(); @@ -34,7 +34,7 @@ public void testIsLocalHost() { } @Test - public void testRemoveScheme() { + void testRemoveScheme() { assertThat(removeScheme("http://localhost:9090")).isEqualTo("localhost:9090"); assertThat(removeScheme("https://localhost:9090")).isEqualTo("localhost:9090"); assertThat(removeScheme("https://localhost:9090")).isEqualTo("localhost:9090"); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java index 257d5e829..165a17b18 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java @@ -16,25 +16,25 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class DoubleValueTest { +class DoubleValueTest { private static final Double CONTENT = 1.25; @Test - public void testToBuilder() { + void testToBuilder() { DoubleValue value = DoubleValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @SuppressWarnings("deprecation") @Test - public void testOf() { + void testOf() { DoubleValue value = DoubleValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -42,7 +42,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { DoubleValue.Builder builder = DoubleValue.newBuilder(CONTENT); DoubleValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java index 64517de66..0e8ef6506 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java @@ -16,13 +16,13 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class EntityTest { +class EntityTest { private static final Key KEY1 = Key.newBuilder("ds1", "k1", "n1").build(); private static final Key KEY2 = Key.newBuilder("ds1", "k2", 1).build(); @@ -32,14 +32,14 @@ public class EntityTest { Entity.newBuilder(INCOMPLETE_KEY).set("a", "b").build(); @Test - public void testEntity() { + void testEntity() { assertTrue(ENTITY.hasKey()); assertEquals(KEY1, ENTITY.getKey()); assertEquals("bar", ENTITY.getString("foo")); } @Test - public void testCopyFrom() { + void testCopyFrom() { Entity.Builder builder = Entity.newBuilder(ENTITY); assertEquals(ENTITY, builder.build()); Entity entity = builder.setKey(KEY2).build(); @@ -49,7 +49,7 @@ public void testCopyFrom() { } @Test - public void testCopyFromIncompleteEntity() { + void testCopyFromIncompleteEntity() { Entity.Builder builder = Entity.newBuilder(KEY2, INCOMPLETE_ENTITY); Entity entity = builder.build(); assertNotEquals(INCOMPLETE_ENTITY, entity); @@ -57,7 +57,7 @@ public void testCopyFromIncompleteEntity() { } @Test - public void testEntitySize() { + void testEntitySize() { assertEquals(ENTITY.toPb().getSerializedSize(), Entity.calculateSerializedSize(ENTITY)); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java index 7a060ed80..423e0b8fd 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java @@ -16,26 +16,26 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class EntityValueTest { +class EntityValueTest { private static final Key KEY = Key.newBuilder("ds", "kind", 1).build(); private static final Entity CONTENT = Entity.newBuilder(KEY).set("FOO", "BAR").build(); @Test - public void testToBuilder() { + void testToBuilder() { EntityValue value = EntityValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @SuppressWarnings("deprecation") @Test - public void testOf() { + void testOf() { EntityValue value = EntityValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -43,7 +43,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { EntityValue.Builder builder = EntityValue.newBuilder(CONTENT); EntityValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java index 5bad1e30d..e1f450f86 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java @@ -16,14 +16,14 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class FullEntityTest { +class FullEntityTest { private static final Key KEY1 = Key.newBuilder("ds1", "k1", "n1").build(); private static final Key KEY2 = Key.newBuilder("ds1", "k2", 1).build(); @@ -36,7 +36,7 @@ public class FullEntityTest { Entity.newBuilder(INCOMPLETE_KEY).set("a", "b").build(); @Test - public void testFullEntity() { + void testFullEntity() { assertTrue(COMPLETE_ENTITY1.hasKey()); assertEquals(KEY1, COMPLETE_ENTITY1.getKey()); assertEquals("bar", COMPLETE_ENTITY1.getString("foo")); @@ -47,7 +47,7 @@ public void testFullEntity() { } @Test - public void testNoKey() { + void testNoKey() { FullEntity entity = FullEntity.newBuilder().set("foo", "bar").build(); assertFalse(entity.hasKey()); assertNull(entity.getKey()); @@ -59,7 +59,7 @@ public void testNoKey() { } @Test - public void testCopyFrom() { + void testCopyFrom() { FullEntity.Builder builder1 = FullEntity.newBuilder(ENTITY); assertEquals(ENTITY, builder1.build()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GqlQueryProtoPreparerTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GqlQueryProtoPreparerTest.java index 0d2e0ede7..9f05723d8 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GqlQueryProtoPreparerTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GqlQueryProtoPreparerTest.java @@ -21,27 +21,27 @@ import static com.google.cloud.datastore.Query.newGqlQueryBuilder; import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.common.collect.ImmutableMap; import java.util.HashMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class GqlQueryProtoPreparerTest { +class GqlQueryProtoPreparerTest { private final GqlQueryProtoPreparer protoPreparer = new GqlQueryProtoPreparer(); private final GqlQuery.Builder gqlQueryBuilder = newGqlQueryBuilder("SELECT * from Character"); @Test - public void testQueryString() { + void testQueryString() { com.google.datastore.v1.GqlQuery gqlQuery = protoPreparer.prepare(gqlQueryBuilder.build()); assertThat(gqlQuery.getQueryString()).isEqualTo("SELECT * from Character"); } @Test - public void testAllowLiteral() { + void testAllowLiteral() { assertTrue( protoPreparer.prepare(gqlQueryBuilder.setAllowLiteral(true).build()).getAllowLiterals()); assertFalse( @@ -49,7 +49,7 @@ public void testAllowLiteral() { } @Test - public void testNamedBinding() { + void testNamedBinding() { com.google.datastore.v1.GqlQuery gqlQuery = protoPreparer.prepare( gqlQueryBuilder.setBinding("name", "John Doe").setBinding("age", 27).build()); @@ -63,7 +63,7 @@ public void testNamedBinding() { } @Test - public void testPositionalBinding() { + void testPositionalBinding() { com.google.datastore.v1.GqlQuery gqlQuery = protoPreparer.prepare(gqlQueryBuilder.addBinding("John Doe").addBinding(27).build()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GrpcToDatastoreCodeTranslationTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GrpcToDatastoreCodeTranslationTest.java index 3f297989f..e216b9c6c 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GrpcToDatastoreCodeTranslationTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/GrpcToDatastoreCodeTranslationTest.java @@ -19,11 +19,11 @@ import io.grpc.Status.Code; import java.util.EnumMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class GrpcToDatastoreCodeTranslationTest { +class GrpcToDatastoreCodeTranslationTest { @Test - public void grpcCodeToDatastoreCode_expectedMapping() { + void grpcCodeToDatastoreCode_expectedMapping() { EnumMap expected = new EnumMap<>(Code.class); expected.put(Code.OK, com.google.rpc.Code.OK.getNumber()); expected.put(Code.INVALID_ARGUMENT, com.google.rpc.Code.INVALID_ARGUMENT.getNumber()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java index 75549e5ea..e0e27a5e9 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java @@ -16,20 +16,20 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class IncompleteKeyTest { +class IncompleteKeyTest { private static IncompleteKey pk1, pk2, pk4, pk5; private static Key parent1, parent2; - @Before - public void setUp() { + @BeforeEach + void setUp() { pk1 = IncompleteKey.newBuilder("ds", "kind1").build(); parent1 = Key.newBuilder("ds", "kind2", 10).setNamespace("ns").build(); parent2 = Key.newBuilder("ds", "kind2", 10, "test-db").setNamespace("ns").build(); @@ -39,7 +39,7 @@ public void setUp() { } @Test - public void testBuilders() { + void testBuilders() { assertEquals("ds", pk1.getProjectId()); assertEquals("", pk1.getDatabaseId()); assertEquals("kind1", pk1.getKind()); @@ -69,7 +69,7 @@ public void testBuilders() { } @Test - public void testParent() { + void testParent() { assertNull(pk1.getParent()); assertEquals(parent1, pk2.getParent()); assertEquals(parent2, pk5.getParent()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java index 37017c28e..99465e81f 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java @@ -16,27 +16,28 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Iterator; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class KeyFactoryTest { +class KeyFactoryTest { private static final String PROJECT_ID = "projectid"; private static final String DATABASE_ID = "database-id"; private KeyFactory keyFactory; - @Before - public void setUp() { + @BeforeEach + void setUp() { keyFactory = new KeyFactory(PROJECT_ID).setDatabaseId(DATABASE_ID).setKind("k"); } @Test - public void testReset() { + void testReset() { IncompleteKey key = keyFactory .setProjectId("ds1") @@ -51,11 +52,10 @@ public void testReset() { assertEquals(1, key.getAncestors().size()); keyFactory.reset(); - try { - keyFactory.newKey(1); - } catch (NullPointerException ex) { - assertEquals("kind must not be null", ex.getMessage()); - } + KeyFactory finalKeyFactory = keyFactory; + NullPointerException ex = + assertThrows(NullPointerException.class, () -> finalKeyFactory.newKey(1)); + assertEquals("kind must not be null", ex.getMessage()); keyFactory.setKind("k1"); key = keyFactory.newKey(); assertEquals("k1", key.getKind()); @@ -80,7 +80,7 @@ public void testReset() { } @Test - public void testCreatedWithDbId() { + void testCreatedWithDbId() { KeyFactory keyFactory = new KeyFactory(PROJECT_ID, "namespace", DATABASE_ID).setKind("k"); IncompleteKey key = keyFactory @@ -96,11 +96,10 @@ public void testCreatedWithDbId() { assertEquals(1, key.getAncestors().size()); keyFactory.reset(); - try { - keyFactory.newKey(1); - } catch (NullPointerException ex) { - assertEquals("kind must not be null", ex.getMessage()); - } + KeyFactory finalKeyFactory = keyFactory; + NullPointerException ex = + assertThrows(NullPointerException.class, () -> finalKeyFactory.newKey(1)); + assertEquals("kind must not be null", ex.getMessage()); keyFactory.setKind("k1"); key = keyFactory.newKey(); assertEquals("k1", key.getKind()); @@ -125,7 +124,7 @@ public void testCreatedWithDbId() { } @Test - public void testNewKey() { + void testNewKey() { Key key = keyFactory.newKey(1); verifyKey(key, 1L, ""); key = keyFactory.newKey("n"); @@ -137,7 +136,7 @@ public void testNewKey() { } @Test - public void testNewIncompleteKey() { + void testNewIncompleteKey() { IncompleteKey key = keyFactory.newKey(); verifyIncompleteKey(key, ""); PathElement p1 = PathElement.of("k1", "n"); @@ -146,9 +145,9 @@ public void testNewIncompleteKey() { verifyIncompleteKey(key, "ns", p1, p2); } - @Test(expected = NullPointerException.class) - public void testNewIncompleteWithNoKind() { - new KeyFactory(PROJECT_ID).build(); + @Test + void testNewIncompleteWithNoKind() { + assertThrows(NullPointerException.class, () -> new KeyFactory(PROJECT_ID).build()); } private void verifyKey(Key key, String name, String namespace, PathElement... ancestors) { diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java index cb3d13fdb..ec1f8a8aa 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java @@ -16,16 +16,16 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class KeyTest { +class KeyTest { @Test - public void testHasId() { + void testHasId() { Key.Builder builder = Key.newBuilder("d", "k", 10); Key key = builder.build(); assertTrue(key.hasId()); @@ -34,7 +34,7 @@ public void testHasId() { } @Test - public void testId() { + void testId() { Key.Builder builder = Key.newBuilder("d", "k", 10); Key key = builder.build(); assertEquals(Long.valueOf(10), key.getId()); @@ -43,7 +43,7 @@ public void testId() { } @Test - public void testHasName() { + void testHasName() { Key.Builder builder = Key.newBuilder("d", "k", "n"); Key key = builder.build(); assertTrue(key.hasName()); @@ -52,7 +52,7 @@ public void testHasName() { } @Test - public void testName() { + void testName() { Key.Builder builder = Key.newBuilder("d", "k", "n"); Key key = builder.build(); assertEquals("n", key.getName()); @@ -61,7 +61,7 @@ public void testName() { } @Test - public void testNameOrId() { + void testNameOrId() { Key.Builder builder = Key.newBuilder("d", "k", "n"); Key key = builder.build(); assertEquals("n", key.getNameOrId()); @@ -70,7 +70,7 @@ public void testNameOrId() { } @Test - public void testToAndFromUrlSafe() { + void testToAndFromUrlSafe() { Key key = Key.newBuilder("d", "k", "n").build(); String urlSafe = key.toUrlSafe(); Key copy = Key.fromUrlSafe(urlSafe); @@ -78,7 +78,7 @@ public void testToAndFromUrlSafe() { } @Test - public void testDatabaseId() { + void testDatabaseId() { Key.Builder builder = Key.newBuilder("project-id", "kind", "name", "database-id"); Key key = builder.build(); assertEquals("database-id", key.getDatabaseId()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java index e589f7d31..e3e3fd634 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java @@ -16,25 +16,25 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class KeyValueTest { +class KeyValueTest { private static final Key CONTENT = Key.newBuilder("ds", "kind", 1).build(); @Test - public void testToBuilder() { + void testToBuilder() { KeyValue value = KeyValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @SuppressWarnings("deprecation") @Test - public void testOf() { + void testOf() { KeyValue value = KeyValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -42,7 +42,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { KeyValue.Builder builder = KeyValue.newBuilder(CONTENT); KeyValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java index 9363fc15a..00e3f3558 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java @@ -16,14 +16,14 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.testing.EqualsTester; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class LatLngTest { +class LatLngTest { private static LatLng gp1 = new LatLng(37.422035, -122.084124); private static LatLng gp2 = new LatLng(0.0, 0.0); @@ -34,59 +34,47 @@ public class LatLngTest { "latitude must be in the range [-180, 180] degrees"; @Test - public void testLatLng() { + void testLatLng() { assertEquals(37.422035, gp1.getLatitude(), 0); assertEquals(-122.084124, gp1.getLongitude(), 0); } @Test - public void testEquals() { + void testEquals() { EqualsTester equalsTester = new EqualsTester(); equalsTester.addEqualityGroup(gp1, gp1).testEquals(); assertNotEquals(gp1, gp2); } @Test - public void testUpperLatRange() { - try { - new LatLng(90, 0); - new LatLng(91, 0); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertEquals(INVALID_LAT_MESSAGE, ex.getMessage()); - } + void testUpperLatRange() { + new LatLng(90, 0); + IllegalArgumentException ex = + assertThrows(IllegalArgumentException.class, () -> new LatLng(91, 0)); + assertEquals(INVALID_LAT_MESSAGE, ex.getMessage()); } @Test - public void testLowerLatRange() { - try { - new LatLng(-90, 0); - new LatLng(-91, 0); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertEquals(INVALID_LAT_MESSAGE, ex.getMessage()); - } + void testLowerLatRange() { + new LatLng(-90, 0); + IllegalArgumentException ex = + assertThrows(IllegalArgumentException.class, () -> new LatLng(-91, 0)); + assertEquals(INVALID_LAT_MESSAGE, ex.getMessage()); } @Test - public void testUpperLngRange() { - try { - new LatLng(0, 180); - new LatLng(0, 181); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertEquals(INVALID_LNG_MESSAGE, ex.getMessage()); - } + void testUpperLngRange() { + new LatLng(0, 180); + IllegalArgumentException ex = + assertThrows(IllegalArgumentException.class, () -> new LatLng(0, 181)); + assertEquals(INVALID_LNG_MESSAGE, ex.getMessage()); } @Test - public void testLowerLngRange() { - try { - new LatLng(0, 180); - new LatLng(0, -181); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertEquals(INVALID_LNG_MESSAGE, ex.getMessage()); - } + void testLowerLngRange() { + new LatLng(0, 180); + IllegalArgumentException ex = + assertThrows(IllegalArgumentException.class, () -> new LatLng(0, -181)); + assertEquals(INVALID_LNG_MESSAGE, ex.getMessage()); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java index 6ae6b5c2c..7b6ca6cc4 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java @@ -16,25 +16,25 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class LatLngValueTest { +class LatLngValueTest { private static final LatLng CONTENT = new LatLng(37.4, -122.1); @Test - public void testToBuilder() { + void testToBuilder() { LatLngValue value = LatLngValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @SuppressWarnings("deprecation") @Test - public void testOf() { + void testOf() { LatLngValue value = LatLngValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -42,7 +42,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { LatLngValue.Builder builder = LatLngValue.newBuilder(CONTENT); LatLngValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java index 44ea74a64..bfcd9b83e 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java @@ -16,17 +16,17 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; import com.google.cloud.Timestamp; import com.google.common.collect.ImmutableList; import java.util.Collections; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ListValueTest { +class ListValueTest { private static final List> CONTENT = ImmutableList.of(NullValue.of(), StringValue.of("foo")); @@ -50,13 +50,13 @@ public class ListValueTest { private static final Blob BLOB2 = Blob.copyFrom(new byte[] {0xB, 0x0, 0x0, 0x0}); @Test - public void testToBuilder() { + void testToBuilder() { ListValue value = ListValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { ListValue value = ListValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -106,7 +106,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { ListValue.Builder builder = ListValue.newBuilder().set(CONTENT); ListValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java index 9f355fd02..d5a90d274 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java @@ -16,25 +16,25 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class LongValueTest { +class LongValueTest { private static final Long CONTENT = 125L; @Test - public void testToBuilder() { + void testToBuilder() { LongValue value = LongValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @SuppressWarnings("deprecation") @Test - public void testOf() { + void testOf() { LongValue value = LongValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -42,7 +42,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { LongValue.Builder builder = LongValue.newBuilder(CONTENT); LongValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java index 3bd500219..dbe0cc019 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java @@ -16,23 +16,23 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class NullValueTest { +class NullValueTest { @Test - public void testToBuilder() { + void testToBuilder() { NullValue value = NullValue.of(); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { NullValue value = NullValue.of(); assertNull(value.get()); assertFalse(value.excludeFromIndexes()); @@ -40,7 +40,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { NullValue.Builder builder = NullValue.newBuilder(); NullValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertNull(value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java index efeb8efa7..f396d8eaa 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java @@ -16,56 +16,56 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class PathElementTest { +class PathElementTest { private static final PathElement PE_1 = PathElement.of("k1"); private static final PathElement PE_2 = PathElement.of("k2", "n"); private static final PathElement PE_3 = PathElement.of("k3", 1); @Test - public void testKind() { + void testKind() { assertEquals("k1", PE_1.getKind()); assertEquals("k2", PE_2.getKind()); assertEquals("k3", PE_3.getKind()); } @Test - public void testHasId() { + void testHasId() { assertFalse(PE_1.hasId()); assertFalse(PE_2.hasId()); assertTrue(PE_3.hasId()); } @Test - public void testId() { + void testId() { assertNull(PE_1.getId()); assertNull(PE_2.getId()); assertEquals(Long.valueOf(1), PE_3.getId()); } @Test - public void testHasName() { + void testHasName() { assertFalse(PE_1.hasName()); assertTrue(PE_2.hasName()); assertFalse(PE_3.hasName()); } @Test - public void testName() { + void testName() { assertNull(PE_1.getName()); assertEquals("n", PE_2.getName()); assertNull(PE_3.getName()); } @Test - public void testNameOrId() { + void testNameOrId() { assertNull(PE_1.getNameOrId()); assertEquals("n", PE_2.getNameOrId()); assertEquals(Long.valueOf(1), PE_3.getNameOrId()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java index 14a735644..a3547852a 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java @@ -16,16 +16,16 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +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.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.Timestamp; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ProjectionEntityTest { +class ProjectionEntityTest { private static final Key KEY = Key.newBuilder("ds1", "k1", "n1").build(); private static final StringValue STRING_INDEX_VALUE = @@ -49,25 +49,25 @@ public class ProjectionEntityTest { .build(); @Test - public void testHasKey() { + void testHasKey() { assertTrue(ENTITY1.hasKey()); assertFalse(ENTITY2.hasKey()); } @Test - public void testKey() { + void testKey() { assertEquals(KEY, ENTITY1.getKey()); assertNull(ENTITY2.getKey()); } @Test - public void testGetBlob() { + void testGetBlob() { assertArrayEquals(STRING_INDEX_VALUE.get().getBytes(), ENTITY2.getBlob("a").toByteArray()); assertEquals(BLOB_VALUE.get(), ENTITY2.getBlob("b")); } @Test - public void testGetTimestamp() { + void testGetTimestamp() { assertEquals(TIMESTAMP_VALUE.get(), ENTITY2.getTimestamp("c")); assertEquals(TIMESTAMP_VALUE.get(), ENTITY2.getTimestamp("d")); } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java index 8d10a9f9f..a334dc4f1 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java @@ -16,24 +16,24 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class RawValueTest { +class RawValueTest { private static final com.google.datastore.v1.Value CONTENT = StringValue.of("hello").toPb(); @Test - public void testToBuilder() { + void testToBuilder() { RawValue value = RawValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { RawValue value = RawValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -41,7 +41,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { RawValue.Builder builder = RawValue.newBuilder(CONTENT); RawValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ReadOptionProtoPreparerTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ReadOptionProtoPreparerTest.java index b16fdf100..a745eda86 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ReadOptionProtoPreparerTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ReadOptionProtoPreparerTest.java @@ -21,22 +21,22 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.datastore.v1.ReadOptions.ReadConsistency.EVENTUAL; import static java.util.Collections.singletonList; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.cloud.Timestamp; import com.google.common.collect.ImmutableList; import com.google.datastore.v1.ReadOptions; import java.util.Arrays; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ReadOptionProtoPreparerTest { +class ReadOptionProtoPreparerTest { private final ReadOptionProtoPreparer protoPreparer = new ReadOptionProtoPreparer(); @Test - public void shouldThrowErrorWhenUsingMultipleReadOptions() { + void shouldThrowErrorWhenUsingMultipleReadOptions() { assertThrows( DatastoreException.class, () -> @@ -62,14 +62,14 @@ public void shouldThrowErrorWhenUsingMultipleReadOptions() { } @Test - public void shouldPrepareReadOptionsWithEventualConsistency() { + void shouldPrepareReadOptionsWithEventualConsistency() { Optional readOptions = protoPreparer.prepare(singletonList(eventualConsistency())); assertThat(readOptions.get().getReadConsistency()).isEqualTo(EVENTUAL); } @Test - public void shouldPrepareReadOptionsWithReadTime() { + void shouldPrepareReadOptionsWithReadTime() { Timestamp timestamp = Timestamp.now(); Optional readOptions = protoPreparer.prepare(singletonList(readTime(timestamp))); @@ -77,7 +77,7 @@ public void shouldPrepareReadOptionsWithReadTime() { } @Test - public void shouldPrepareReadOptionsWithTransactionId() { + void shouldPrepareReadOptionsWithTransactionId() { String transactionId = "transaction-id"; Optional readOptions = protoPreparer.prepare(singletonList(transactionId(transactionId))); @@ -86,12 +86,12 @@ public void shouldPrepareReadOptionsWithTransactionId() { } @Test - public void shouldReturnNullWhenReadOptionsIsNull() { + void shouldReturnNullWhenReadOptionsIsNull() { assertFalse(protoPreparer.prepare(null).isPresent()); } @Test - public void shouldReturnNullWhenReadOptionsIsAnEmptyList() { + void shouldReturnNullWhenReadOptionsIsAnEmptyList() { assertFalse(protoPreparer.prepare(ImmutableList.of()).isPresent()); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java index 1b8186a54..5ca20d343 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java @@ -26,7 +26,7 @@ import com.google.cloud.datastore.StructuredQuery.OrderBy; import com.google.cloud.datastore.StructuredQuery.PropertyFilter; -public class SerializationTest extends BaseSerializationTest { +class SerializationTest extends BaseSerializationTest { private static final IncompleteKey INCOMPLETE_KEY1 = IncompleteKey.newBuilder("ds", "k").addAncestor(PathElement.of("p", 1)).build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java index 88aa841d3..d897dacd7 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java @@ -16,24 +16,24 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class StringValueTest { +class StringValueTest { private static final String CONTENT = "hello world"; @Test - public void testToBuilder() { + void testToBuilder() { StringValue value = StringValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { StringValue value = StringValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -41,7 +41,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { StringValue.Builder builder = StringValue.newBuilder(CONTENT); StringValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryProtoPreparerTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryProtoPreparerTest.java index 60937fc28..d7e338037 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryProtoPreparerTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryProtoPreparerTest.java @@ -30,14 +30,14 @@ import com.google.datastore.v1.Query; import com.google.protobuf.ByteString; import com.google.protobuf.Int32Value; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class StructuredQueryProtoPreparerTest { +class StructuredQueryProtoPreparerTest { private final StructuredQueryProtoPreparer protoPreparer = new StructuredQueryProtoPreparer(); @Test - public void testKind() { + void testKind() { Query queryProto = protoPreparer.prepare(newEntityQueryBuilder().setKind("kind").build()); assertThat(queryProto.getKind(0)) @@ -45,7 +45,7 @@ public void testKind() { } @Test - public void testStartCursor() { + void testStartCursor() { byte[] bytes = {1, 2}; Query queryProto = protoPreparer.prepare( @@ -55,7 +55,7 @@ public void testStartCursor() { } @Test - public void testEndCursor() { + void testEndCursor() { byte[] bytes = {1, 2}; Query queryProto = protoPreparer.prepare(newEntityQueryBuilder().setEndCursor(Cursor.copyFrom(bytes)).build()); @@ -64,21 +64,21 @@ public void testEndCursor() { } @Test - public void testOffset() { + void testOffset() { Query queryProto = protoPreparer.prepare(newEntityQueryBuilder().setOffset(5).build()); assertThat(queryProto.getOffset()).isEqualTo(5); } @Test - public void testLimit() { + void testLimit() { Query queryProto = protoPreparer.prepare(newEntityQueryBuilder().setLimit(5).build()); assertThat(queryProto.getLimit()).isEqualTo(Int32Value.of(5)); } @Test - public void testFilter() { + void testFilter() { Query queryProto = protoPreparer.prepare( newEntityQueryBuilder().setFilter(PropertyFilter.eq("done", true)).build()); @@ -87,7 +87,7 @@ public void testFilter() { } @Test - public void testOrderBy() { + void testOrderBy() { Query queryProto = protoPreparer.prepare( newEntityQueryBuilder() @@ -99,7 +99,7 @@ public void testOrderBy() { } @Test - public void testDistinctOn() { + void testDistinctOn() { Query queryProto = protoPreparer.prepare(newEntityQueryBuilder().setDistinctOn("dept-id", "rank").build()); @@ -108,7 +108,7 @@ public void testDistinctOn() { } @Test - public void testProjections() { + void testProjections() { Query queryProto = protoPreparer.prepare(newEntityQueryBuilder().setProjection("dept-id", "rank").build()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java index c59337586..29093bcd3 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java @@ -16,9 +16,9 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; import com.google.cloud.datastore.Query.ResultType; import com.google.cloud.datastore.StructuredQuery.CompositeFilter; @@ -27,9 +27,9 @@ import com.google.cloud.datastore.StructuredQuery.PropertyFilter; import com.google.common.collect.ImmutableList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class StructuredQueryTest { +class StructuredQueryTest { private static final String NAMESPACE = "ns"; private static final String KIND = "k"; @@ -87,14 +87,14 @@ public class StructuredQueryTest { .build(); @Test - public void testEntityQueryBuilder() { + void testEntityQueryBuilder() { compareBaseBuilderFields(ENTITY_QUERY); assertTrue(ENTITY_QUERY.getProjection().isEmpty()); assertTrue(ENTITY_QUERY.getDistinctOn().isEmpty()); } @Test - public void testKeyQueryBuilder() { + void testKeyQueryBuilder() { assertEquals(NAMESPACE, KEY_QUERY.getNamespace()); assertEquals(KIND, KEY_QUERY.getKind()); assertEquals(START_CURSOR, KEY_QUERY.getStartCursor()); @@ -108,7 +108,7 @@ public void testKeyQueryBuilder() { } @Test - public void testProjectionEntityQueryBuilder() { + void testProjectionEntityQueryBuilder() { compareBaseBuilderFields(PROJECTION_QUERY); assertEquals(PROJECTION, PROJECTION_QUERY.getProjection()); assertEquals(DISTINCT_ON, PROJECTION_QUERY.getDistinctOn()); @@ -126,7 +126,7 @@ private void compareBaseBuilderFields(StructuredQuery query) { } @Test - public void mergeFrom() { + void mergeFrom() { compareMergedQuery( ENTITY_QUERY, new EntityQuery.Builder().mergeFrom(ENTITY_QUERY.toPb()).build()); compareMergedQuery(KEY_QUERY, new KeyQuery.Builder().mergeFrom(KEY_QUERY.toPb()).build()); @@ -148,7 +148,7 @@ private void compareMergedQuery(StructuredQuery expected, StructuredQuery } @Test - public void testToAndFromPb() { + void testToAndFromPb() { assertEquals( ENTITY_QUERY, StructuredQuery.fromPb( @@ -165,7 +165,7 @@ public void testToAndFromPb() { } @Test - public void testToBuilder() { + void testToBuilder() { List> queries = ImmutableList.>of(ENTITY_QUERY, KEY_QUERY, PROJECTION_QUERY); for (StructuredQuery query : queries) { @@ -174,7 +174,7 @@ public void testToBuilder() { } @Test - public void testKeyOnly() { + void testKeyOnly() { assertTrue(KEY_QUERY.isKeyOnly()); assertFalse(ENTITY_QUERY.isKeyOnly()); assertFalse(PROJECTION_QUERY.isKeyOnly()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TimestampValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TimestampValueTest.java index 10dbaf8c7..5a67d529a 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TimestampValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TimestampValueTest.java @@ -16,25 +16,25 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; import com.google.cloud.Timestamp; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class TimestampValueTest { +class TimestampValueTest { private static final Timestamp CONTENT = Timestamp.now(); @Test - public void testToBuilder() { + void testToBuilder() { TimestampValue value = TimestampValue.of(CONTENT); assertEquals(value, value.toBuilder().build()); } @Test - public void testOf() { + void testOf() { TimestampValue value = TimestampValue.of(CONTENT); assertEquals(CONTENT, value.get()); assertFalse(value.excludeFromIndexes()); @@ -42,7 +42,7 @@ public void testOf() { @SuppressWarnings("deprecation") @Test - public void testBuilder() { + void testBuilder() { TimestampValue.Builder builder = TimestampValue.newBuilder(CONTENT); TimestampValue value = builder.setMeaning(1).setExcludeFromIndexes(true).build(); assertEquals(CONTENT, value.get()); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TransactionExceptionHandlerTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TransactionExceptionHandlerTest.java index d531456e0..456efdc6e 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TransactionExceptionHandlerTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/TransactionExceptionHandlerTest.java @@ -16,18 +16,18 @@ package com.google.cloud.datastore; -import static junit.framework.TestCase.assertFalse; -import static junit.framework.TestCase.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.BaseServiceException; import com.google.cloud.ExceptionHandler; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** Tests for {@link TransactionExceptionHandler}. */ -public class TransactionExceptionHandlerTest { +class TransactionExceptionHandlerTest { @Test - public void testShouldTry() { + void testShouldTry() { ExceptionHandler handler = ExceptionHandler.newBuilder() .abortOn(RuntimeException.class) diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java index 8d53dc736..9a09d074b 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java @@ -16,9 +16,9 @@ package com.google.cloud.datastore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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.assertTrue; import com.google.cloud.Timestamp; import com.google.common.collect.ImmutableList; @@ -28,10 +28,10 @@ import java.util.Collections; import java.util.Map; import java.util.Set; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class ValueTest { +class ValueTest { private static final Key KEY = Key.newBuilder("ds", "kind", 1).build(); private static final Blob BLOB = Blob.copyFrom(new byte[] {}); @@ -81,8 +81,8 @@ public TestBuilder toBuilder() { } } - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { ImmutableMap.Builder> builder = ImmutableMap.builder(); for (ValueType valueType : ValueType.values()) { Object[] values = TYPES.get(valueType); @@ -107,21 +107,21 @@ public void setUp() throws Exception { } } } - assertTrue("Could not find an of method for " + valueClass, found); + assertTrue(found, "Could not find an of method for " + valueClass); } } typeToValue = builder.buildOrThrow(); } @Test - public void testType() { + void testType() { for (Map.Entry> entry : typeToValue.entrySet()) { assertEquals(entry.getKey(), entry.getValue().getType()); } } @Test - public void testExcludeFromIndexes() { + void testExcludeFromIndexes() { for (Map.Entry> entry : typeToValue.entrySet()) { assertFalse(entry.getValue().excludeFromIndexes()); } @@ -133,13 +133,13 @@ public void testExcludeFromIndexes() { @SuppressWarnings("deprecation") @Test - public void testMeaning() { + void testMeaning() { TestBuilder builder = new TestBuilder(); assertEquals(10, builder.setMeaning(10).build().getMeaning()); } @Test - public void testGet() { + void testGet() { for (Map.Entry> entry : typeToValue.entrySet()) { ValueType valueType = entry.getKey(); Value value = entry.getValue(); @@ -153,7 +153,7 @@ public void testGet() { @SuppressWarnings({"unchecked", "deprecation"}) @Test - public void testToBuilder() { + void testToBuilder() { Set content = Collections.singleton("bla"); @SuppressWarnings("rawtypes") ValueBuilder builder = new TestBuilder(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientHttpJsonTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientHttpJsonTest.java index 60e786eb9..61105dee8 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientHttpJsonTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientHttpJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientTest.java index e279f543e..a4c32d7c7 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/DatastoreAdminClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdmin.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdmin.java index ab02d565b..0e0d17e4f 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdmin.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdmin.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdminImpl.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdminImpl.java index 7ac63a381..d9be1ba4d 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdminImpl.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/admin/v1/MockDatastoreAdminImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/AvgAggregationTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/AvgAggregationTest.java index ac785c8b3..89c9f657a 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/AvgAggregationTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/AvgAggregationTest.java @@ -18,20 +18,20 @@ import static com.google.cloud.datastore.aggregation.Aggregation.avg; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.datastore.v1.AggregationQuery; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class AvgAggregationTest { +class AvgAggregationTest { @Test - public void shouldThrowExceptionWhenPropertyReferenceIsNull() { + void shouldThrowExceptionWhenPropertyReferenceIsNull() { assertThrows(IllegalArgumentException.class, () -> avg(null).build()); } @Test - public void testAvgAggregationWithDefaultValues() { + void testAvgAggregationWithDefaultValues() { AggregationQuery.Aggregation avgAggregation = avg("marks").build().toPb(); assertThat(avgAggregation.getAvg().getProperty().getName()).isEqualTo("marks"); @@ -39,7 +39,7 @@ public void testAvgAggregationWithDefaultValues() { } @Test - public void testCountAggregationWithAlias() { + void testCountAggregationWithAlias() { AggregationQuery.Aggregation avgAggregation = avg("marks").as("total_marks").build().toPb(); assertThat(avgAggregation.getAvg().getProperty().getName()).isEqualTo("marks"); @@ -47,7 +47,7 @@ public void testCountAggregationWithAlias() { } @Test - public void testEqualsWithAliasVariations() { + void testEqualsWithAliasVariations() { AvgAggregation.Builder aggregationWithAlias1 = avg("marks").as("total"); AvgAggregation.Builder aggregationWithAlias2 = avg("marks").as("total"); AvgAggregation.Builder aggregationWithoutAlias1 = avg("marks"); @@ -73,7 +73,7 @@ public void testEqualsWithAliasVariations() { } @Test - public void testEqualsWithPropertyReferenceVariations() { + void testEqualsWithPropertyReferenceVariations() { AvgAggregation totalMarks1 = avg("marks").build(); AvgAggregation totalMarks2 = avg("marks").build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/CountAggregationTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/CountAggregationTest.java index a8b3bc945..9953140bc 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/CountAggregationTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/CountAggregationTest.java @@ -20,12 +20,12 @@ import static com.google.common.truth.Truth.assertThat; import com.google.datastore.v1.AggregationQuery; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class CountAggregationTest { +class CountAggregationTest { @Test - public void testCountAggregationWithDefaultValues() { + void testCountAggregationWithDefaultValues() { AggregationQuery.Aggregation countAggregationPb = count().build().toPb(); assertThat(countAggregationPb.getCount().getUpTo().getValue()).isEqualTo(0L); @@ -33,7 +33,7 @@ public void testCountAggregationWithDefaultValues() { } @Test - public void testCountAggregationWithAlias() { + void testCountAggregationWithAlias() { AggregationQuery.Aggregation countAggregationPb = count().as("column_1").build().toPb(); assertThat(countAggregationPb.getCount().getUpTo().getValue()).isEqualTo(0L); @@ -41,7 +41,7 @@ public void testCountAggregationWithAlias() { } @Test - public void testEquals() { + void testEquals() { CountAggregation.Builder aggregationWithAlias1 = count().as("total"); CountAggregation.Builder aggregationWithAlias2 = count().as("total"); CountAggregation.Builder aggregationWithoutAlias1 = count(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/SumAggregationTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/SumAggregationTest.java index e4f637af0..9bf8109d5 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/SumAggregationTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/aggregation/SumAggregationTest.java @@ -18,20 +18,20 @@ import static com.google.cloud.datastore.aggregation.Aggregation.sum; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.datastore.v1.AggregationQuery; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class SumAggregationTest { +class SumAggregationTest { @Test - public void shouldThrowExceptionWhenPropertyReferenceIsNull() { + void shouldThrowExceptionWhenPropertyReferenceIsNull() { assertThrows(IllegalArgumentException.class, () -> sum(null).build()); } @Test - public void testSumAggregationWithDefaultValues() { + void testSumAggregationWithDefaultValues() { AggregationQuery.Aggregation sumAggregation = sum("marks").build().toPb(); assertThat(sumAggregation.getSum().getProperty().getName()).isEqualTo("marks"); @@ -39,7 +39,7 @@ public void testSumAggregationWithDefaultValues() { } @Test - public void testCountAggregationWithAlias() { + void testCountAggregationWithAlias() { AggregationQuery.Aggregation sumAggregation = sum("marks").as("total_marks").build().toPb(); assertThat(sumAggregation.getSum().getProperty().getName()).isEqualTo("marks"); @@ -47,7 +47,7 @@ public void testCountAggregationWithAlias() { } @Test - public void testEqualsWithAliasVariations() { + void testEqualsWithAliasVariations() { SumAggregation.Builder aggregationWithAlias1 = sum("marks").as("total"); SumAggregation.Builder aggregationWithAlias2 = sum("marks").as("total"); SumAggregation.Builder aggregationWithoutAlias1 = sum("marks"); @@ -73,7 +73,7 @@ public void testEqualsWithAliasVariations() { } @Test - public void testEqualsWithPropertyReferenceVariations() { + void testEqualsWithPropertyReferenceVariations() { SumAggregation totalMarks1 = sum("marks").build(); SumAggregation totalMarks2 = sum("marks").build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/AggregationQueryExecutorTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/AggregationQueryExecutorTest.java index 46752ba89..d7d2f26cd 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/AggregationQueryExecutorTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/AggregationQueryExecutorTest.java @@ -46,10 +46,9 @@ import java.util.Map; import java.util.function.Predicate; import org.easymock.EasyMock; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; -public class AggregationQueryExecutorTest { +class AggregationQueryExecutorTest { private static final String KIND = "Task"; private static final String NAMESPACE = "ns"; @@ -58,16 +57,15 @@ public class AggregationQueryExecutorTest { private AggregationQueryExecutor queryExecutor; private DatastoreOptions datastoreOptions; - @Before - public void setUp() throws Exception { + @BeforeEach + void setUp() throws Exception { mockRpc = EasyMock.createStrictMock(DatastoreRpc.class); datastoreOptions = DatastoreOptions.newBuilder().setProjectId("project-id").setNamespace(NAMESPACE).build(); queryExecutor = new AggregationQueryExecutor(mockRpc, datastoreOptions); } - @Test - public void shouldExecuteAggregationQuery() { + void shouldExecuteAggregationQuery() { EntityQuery nestedQuery = Query.newEntityQueryBuilder() .setNamespace(NAMESPACE) @@ -105,8 +103,7 @@ public void shouldExecuteAggregationQuery() { null)); } - @Test - public void shouldExecuteAggregationQueryWithReadOptions() { + void shouldExecuteAggregationQueryWithReadOptions() { EntityQuery nestedQuery = Query.newEntityQueryBuilder() .setNamespace(NAMESPACE) diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/request/AggregationQueryRequestProtoPreparerTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/request/AggregationQueryRequestProtoPreparerTest.java index 4aec8f7bb..7347ca1b5 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/request/AggregationQueryRequestProtoPreparerTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/request/AggregationQueryRequestProtoPreparerTest.java @@ -43,9 +43,9 @@ import com.google.datastore.v1.ExplainOptions; import com.google.datastore.v1.RunAggregationQueryRequest; import java.util.HashMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class AggregationQueryRequestProtoPreparerTest { +class AggregationQueryRequestProtoPreparerTest { private static final String KIND = "Task"; private static final String NAMESPACE = "ns"; @@ -90,7 +90,7 @@ public class AggregationQueryRequestProtoPreparerTest { new AggregationQueryRequestProtoPreparer(DATASTORE_OPTIONS); @Test - public void shouldPrepareAggregationQueryRequestWithGivenStructuredQuery() { + void shouldPrepareAggregationQueryRequestWithGivenStructuredQuery() { RunAggregationQueryRequest runAggregationQueryRequest = protoPreparer.prepare(QueryConfig.create(AGGREGATION_OVER_STRUCTURED_QUERY, null)); @@ -114,7 +114,7 @@ public void shouldPrepareAggregationQueryRequestWithGivenStructuredQuery() { } @Test - public void shouldPrepareAggregationQueryRequestWithGivenGqlQuery() { + void shouldPrepareAggregationQueryRequestWithGivenGqlQuery() { RunAggregationQueryRequest runAggregationQueryRequest = protoPreparer.prepare(QueryConfig.create(AGGREGATION_OVER_GQL_QUERY, null)); @@ -137,7 +137,7 @@ public void shouldPrepareAggregationQueryRequestWithGivenGqlQuery() { } @Test - public void shouldPrepareReadOptionsWithGivenStructuredQuery() { + void shouldPrepareReadOptionsWithGivenStructuredQuery() { RunAggregationQueryRequest eventualConsistencyAggregationRequest = prepareQuery(AGGREGATION_OVER_STRUCTURED_QUERY, eventualConsistency()); assertThat(eventualConsistencyAggregationRequest.getReadOptions().getReadConsistency()) @@ -151,7 +151,7 @@ public void shouldPrepareReadOptionsWithGivenStructuredQuery() { } @Test - public void shouldPrepareReadOptionsWithGivenGqlQuery() { + void shouldPrepareReadOptionsWithGivenGqlQuery() { RunAggregationQueryRequest eventualConsistencyAggregationRequest = prepareQuery(AGGREGATION_OVER_GQL_QUERY, eventualConsistency()); assertThat(eventualConsistencyAggregationRequest.getReadOptions().getReadConsistency()) @@ -165,7 +165,7 @@ public void shouldPrepareReadOptionsWithGivenGqlQuery() { } @Test - public void shouldPrepareAggregationQueryWithNamespaceFromDatastoreOptions() { + void shouldPrepareAggregationQueryWithNamespaceFromDatastoreOptions() { AggregationQuery structuredQueryWithoutNamespace = Query.newAggregationQueryBuilder() .addAggregation(count().as("total")) @@ -187,7 +187,7 @@ public void shouldPrepareAggregationQueryWithNamespaceFromDatastoreOptions() { } @Test - public void shouldPrepareAggregationQueryWithDifferentModes() { + void shouldPrepareAggregationQueryWithDifferentModes() { AggregationQuery structuredQueryWithoutNamespace = Query.newAggregationQueryBuilder() .addAggregation(count().as("total")) diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/response/AggregationQueryResponseTransformerTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/response/AggregationQueryResponseTransformerTest.java index 9263543db..705476ad7 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/response/AggregationQueryResponseTransformerTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/execution/response/AggregationQueryResponseTransformerTest.java @@ -37,15 +37,15 @@ import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class AggregationQueryResponseTransformerTest { +class AggregationQueryResponseTransformerTest { private final AggregationQueryResponseTransformer responseTransformer = new AggregationQueryResponseTransformer(); @Test - public void shouldTransformAggregationQueryResponseWithIntValues() { + void shouldTransformAggregationQueryResponseWithIntValues() { Map result1 = new HashMap<>( ImmutableMap.of( @@ -85,7 +85,7 @@ public void shouldTransformAggregationQueryResponseWithIntValues() { } @Test - public void shouldTransformAggregationQueryResponseWithIntValuesWithStats() { + void shouldTransformAggregationQueryResponseWithIntValuesWithStats() { Map result1 = new HashMap<>( ImmutableMap.of( @@ -159,7 +159,7 @@ public void shouldTransformAggregationQueryResponseWithIntValuesWithStats() { } @Test - public void shouldTransformAggregationQueryResponseWithDoubleValues() { + void shouldTransformAggregationQueryResponseWithDoubleValues() { Map result1 = new HashMap<>( ImmutableMap.of( diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java index 53a858cae..7bc675e8a 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/AbstractITDatastoreTest.java @@ -26,14 +26,14 @@ import static com.google.cloud.datastore.aggregation.Aggregation.sum; import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThrows; -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.assertNotEquals; +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.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.Timestamp; import com.google.cloud.Tuple; @@ -99,16 +99,11 @@ import java.util.concurrent.Future; import java.util.function.BiConsumer; import java.util.function.Consumer; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.Timeout; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public abstract class AbstractITDatastoreTest { +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +abstract class AbstractITDatastoreTest { protected static final String CUSTOM_DB_ID = "test-db"; protected DatastoreOptions options; @@ -151,17 +146,13 @@ public abstract class AbstractITDatastoreTest { private static Entity AGGREGATION_ENTITY_2; private static Entity AGGREGATION_ENTITY_3; - @Rule public Timeout globalTimeout = Timeout.seconds(100); - - @Rule public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3); - - @Before - public void setUp() { + @BeforeEach + void setUp() { datastore.put(ENTITY1, ENTITY2); } - @After - public void tearDown() { + @AfterEach + void tearDown() { EntityQuery allEntitiesQuery = Query.newEntityQueryBuilder().build(); QueryResults allEntities = datastore.run(allEntitiesQuery); Key[] keysToDelete = @@ -309,7 +300,7 @@ private List makeResultsCopy(QueryResults scResults) { } @Test - public void orQuery() { + void orQuery() { Key key = Key.newBuilder(KEY1, KIND2, 2).build(); Entity entity3 = Entity.newBuilder(ENTITY1) @@ -388,7 +379,7 @@ public void orQuery() { } @Test - public void testQueryProfile() { + void testQueryProfile() { Key key = Key.newBuilder(KEY1, KIND2, 2).build(); Entity entity3 = Entity.newBuilder(ENTITY1) @@ -464,7 +455,7 @@ public void testQueryProfile() { } @Test - public void testNewTransactionCommit() { + void testNewTransactionCommit() { Transaction transaction = datastore.newTransaction(); transaction.add(ENTITY3); Entity entity2 = Entity.newBuilder(ENTITY2).clear().setNull("bla").build(); @@ -487,7 +478,7 @@ public void testNewTransactionCommit() { } @Test - public void testTransactionWithRead() throws Exception { + void testTransactionWithRead() throws Exception { StatementExecutor statementExecutor = new StatementExecutor(); Transaction baseTransaction = datastore.newTransaction(); assertNull(baseTransaction.get(KEY3)); @@ -522,7 +513,7 @@ public void testTransactionWithRead() throws Exception { } @Test - public void testTransactionWithQuery() throws Exception { + void testTransactionWithQuery() throws Exception { StatementExecutor statementExecutor = new StatementExecutor(); Query query = Query.newEntityQueryBuilder() @@ -566,7 +557,7 @@ public void testTransactionWithQuery() throws Exception { } @Test - public void testTransactionExplainOptionsAnalyze() { + void testTransactionExplainOptionsAnalyze() { StructuredQuery query = Query.newEntityQueryBuilder() .setKind(KIND2) @@ -603,7 +594,7 @@ public void testTransactionExplainOptionsAnalyze() { } @Test - public void testTransactionExplainOptions() { + void testTransactionExplainOptions() { StructuredQuery query = Query.newEntityQueryBuilder() .setKind(KIND2) @@ -660,7 +651,7 @@ private void assertExecutionStats( } @Test - public void testNewTransactionRollback() { + void testNewTransactionRollback() { Transaction transaction = datastore.newTransaction(); transaction.add(ENTITY3); Entity entity2 = @@ -685,7 +676,7 @@ public void testNewTransactionRollback() { } @Test - public void testNewBatch() { + void testNewBatch() { Batch batch = datastore.newBatch(); Entity entity1 = Entity.newBuilder(ENTITY1).clear().build(); Entity entity2 = Entity.newBuilder(ENTITY2).clear().setNull("bla").build(); @@ -741,7 +732,7 @@ public void testNewBatch() { } @Test - public void testRunGqlQueryNoCasting() throws InterruptedException { + void testRunGqlQueryNoCasting() throws InterruptedException { Query query1 = Query.newGqlQueryBuilder(ResultType.ENTITY, "select * from " + KIND1) .setNamespace(NAMESPACE) @@ -830,7 +821,7 @@ public void testRunGqlQueryNoCasting() throws InterruptedException { } @Test - public void testRunGqlQueryWithCasting() throws InterruptedException { + void testRunGqlQueryWithCasting() throws InterruptedException { @SuppressWarnings("unchecked") Query query1 = (Query) @@ -867,7 +858,7 @@ public void testRunGqlQueryWithCasting() throws InterruptedException { } @Test - public void testRunAggregationQuery() { + void testRunAggregationQuery() { // verifying aggregation with an entity query testCountAggregationWith( builder -> @@ -906,7 +897,7 @@ public void testRunAggregationQuery() { } @Test - public void testRunAggregationQueryWithLimit() { + void testRunAggregationQueryWithLimit() { // verifying aggregation with an entity query testCountAggregationWithLimit( builder -> @@ -979,7 +970,7 @@ public void testRunAggregationQueryWithLimit() { } @Test - public void testSumAggregation() { + void testSumAggregation() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1001,7 +992,7 @@ public void testSumAggregation() { } @Test - public void testSumAggregationWithAutoGeneratedAlias() { + void testSumAggregationWithAutoGeneratedAlias() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1023,7 +1014,7 @@ public void testSumAggregationWithAutoGeneratedAlias() { } @Test - public void testSumAggregationInGqlQuery() { + void testSumAggregationInGqlQuery() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); GqlQuery gqlQuery = @@ -1045,7 +1036,7 @@ public void testSumAggregationInGqlQuery() { } @Test - public void testSumAggregationWithResultOfDoubleType() { + void testSumAggregationWithResultOfDoubleType() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1067,7 +1058,7 @@ public void testSumAggregationWithResultOfDoubleType() { } @Test - public void testAvgAggregation() { + void testAvgAggregation() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1089,7 +1080,7 @@ public void testAvgAggregation() { } @Test - public void testAvgAggregationWithAutoGeneratedAlias() { + void testAvgAggregationWithAutoGeneratedAlias() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1111,7 +1102,7 @@ public void testAvgAggregationWithAutoGeneratedAlias() { } @Test - public void testAvgAggregationInGqlQuery() { + void testAvgAggregationInGqlQuery() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); GqlQuery gqlQuery = @@ -1132,7 +1123,7 @@ public void testAvgAggregationInGqlQuery() { } @Test - public void testSumAndAvgAggregationTogether() { + void testSumAndAvgAggregationTogether() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1153,7 +1144,7 @@ public void testSumAndAvgAggregationTogether() { } @Test - public void testTransactionShouldReturnAConsistentSnapshot() { + void testTransactionShouldReturnAConsistentSnapshot() { datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); EntityQuery baseQuery = Query.newEntityQueryBuilder().setKind(MARKS_KIND).build(); @@ -1212,7 +1203,7 @@ public void testTransactionShouldReturnAConsistentSnapshot() { } @Test - public void testReadOnlyTransactionShouldNotLockTheDocuments() + void testReadOnlyTransactionShouldNotLockTheDocuments() throws ExecutionException, InterruptedException { ExecutorService executor = Executors.newSingleThreadExecutor(); datastore.put(AGGREGATION_ENTITY_1, AGGREGATION_ENTITY_2); @@ -1367,7 +1358,7 @@ private void testCountAggregationReadTimeWith(Consumer * Source */ @Test - public void testRunAggregationQueryInTransactionShouldReturnAConsistentSnapshot() { + void testRunAggregationQueryInTransactionShouldReturnAConsistentSnapshot() { Key newEntityKey = Key.newBuilder(KEY1, "newKind", "name-01").build(); EntityQuery entityQuery = Query.newEntityQueryBuilder() @@ -1433,7 +1424,7 @@ public void testRunAggregationQueryInTransactionShouldReturnAConsistentSnapshot( } @Test - public void testRunAggregationQueryInAReadOnlyTransactionShouldNotLockTheCountedDocuments() + void testRunAggregationQueryInAReadOnlyTransactionShouldNotLockTheCountedDocuments() throws Exception { ExecutorService executor = Executors.newSingleThreadExecutor(); EntityQuery entityQuery = @@ -1482,7 +1473,7 @@ public void testRunAggregationQueryInAReadOnlyTransactionShouldNotLockTheCounted } @Test - public void testRunAggregationQueryWithReadTime() throws InterruptedException { + void testRunAggregationQueryWithReadTime() throws InterruptedException { String alias = "total_count"; // verifying aggregation readTime with an entity query @@ -1522,7 +1513,7 @@ public void testRunAggregationQueryWithReadTime() throws InterruptedException { } @Test - public void testRunStructuredQuery() throws InterruptedException { + void testRunStructuredQuery() throws InterruptedException { Query query = Query.newEntityQueryBuilder().setKind(KIND1).setOrderBy(OrderBy.asc("__key__")).build(); @@ -1599,7 +1590,7 @@ public void testRunStructuredQuery() throws InterruptedException { } @Test - public void testInNotInNeqFilters() throws InterruptedException { + void testInNotInNeqFilters() throws InterruptedException { Entity e1 = Entity.newBuilder(ENTITY1) .setKey(Key.newBuilder(INCOMPLETE_KEY1, "e1").build()) @@ -1691,7 +1682,7 @@ public void testInNotInNeqFilters() throws InterruptedException { } @Test - public void testAllocateId() { + void testAllocateId() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(KIND1); IncompleteKey pk1 = keyFactory.newKey(); Key key1 = datastore.allocateId(pk1); @@ -1709,7 +1700,7 @@ public void testAllocateId() { } @Test - public void testReserveIds() { + void testReserveIds() { KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind"); Key key1 = keyFactory.newKey(10); Key key2 = keyFactory.newKey("name"); @@ -1718,7 +1709,7 @@ public void testReserveIds() { } @Test - public void testAllocateIdArray() { + void testAllocateIdArray() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(KIND1); IncompleteKey incompleteKey1 = keyFactory.newKey(); IncompleteKey incompleteKey2 = @@ -1735,7 +1726,7 @@ public void testAllocateIdArray() { } @Test - public void testGet() { + void testGet() { Entity entity = datastore.get(KEY3); assertNull(entity); @@ -1760,7 +1751,7 @@ public void testGet() { } @Test - public void testIncompleteKey() { + void testIncompleteKey() { Key parentKey = null; try { IncompleteKey incompleteKey = IncompleteKey.newBuilder(KEY6, KIND1).build(); @@ -1775,7 +1766,7 @@ public void testIncompleteKey() { } @Test - public void testGetWithReadTime() throws InterruptedException { + void testGetWithReadTime() throws InterruptedException { Key key = Key.newBuilder(PROJECT_ID, "new_kind", "name", options.getDatabaseId()) .setNamespace(NAMESPACE) @@ -1803,7 +1794,7 @@ public void testGetWithReadTime() throws InterruptedException { } @Test - public void testGetArrayNoDeferredResults() { + void testGetArrayNoDeferredResults() { datastore.put(ENTITY3); Iterator result = datastore.fetch(KEY1, Key.newBuilder(KEY1).setName("bla").build(), KEY2, KEY3).iterator(); @@ -1834,7 +1825,7 @@ public void testGetArrayNoDeferredResults() { } @Test - public void testAddEntity() { + void testAddEntity() { List keys = datastore.fetch(ENTITY1.getKey(), ENTITY3.getKey()); assertEquals(ENTITY1, keys.get(0)); assertNull(keys.get(1)); @@ -1859,7 +1850,7 @@ public void testAddEntity() { } @Test - public void testUpdate() { + void testUpdate() { List keys = datastore.fetch(ENTITY1.getKey(), ENTITY3.getKey()); assertEquals(ENTITY1, keys.get(0)); assertNull(keys.get(1)); @@ -1885,7 +1876,7 @@ private void assertDatastoreException( } @Test - public void testPut() { + void testPut() { Entity updatedEntity = Entity.newBuilder(ENTITY1).set("new_property", 42L).build(); assertEquals(updatedEntity, datastore.put(updatedEntity)); assertEquals(updatedEntity, datastore.get(updatedEntity.getKey())); @@ -1909,7 +1900,7 @@ public void testPut() { } @Test - public void testDelete() { + void testDelete() { Iterator keys = datastore.fetch(ENTITY1.getKey(), ENTITY2.getKey(), ENTITY3.getKey()).iterator(); assertEquals(ENTITY1, keys.next()); @@ -1925,7 +1916,7 @@ public void testDelete() { } @Test - public void testRunInTransaction() { + void testRunInTransaction() { Datastore.TransactionCallable callable1 = new Datastore.TransactionCallable() { private Integer attempts = 1; @@ -1966,7 +1957,7 @@ public Integer run(DatastoreReaderWriter transaction) { } @Test - public void testRunInTransactionReadWrite() { + void testRunInTransactionReadWrite() { final Entity entity1 = Entity.newBuilder(ENTITY1).clear().setNull("bla").build(); @@ -2018,14 +2009,14 @@ public Integer run(DatastoreReaderWriter transaction) { } @Test - public void testSkippedResults() { + void testSkippedResults() { Query query = Query.newKeyQueryBuilder().setOffset(Integer.MAX_VALUE).build(); int numberOfEntities = datastore.run(query).getSkippedResults(); assertEquals(2, numberOfEntities); } @Test - public void testSetLimit() { + void testSetLimit() { datastore.put(ENTITY1); Query keyQuery = Query.newKeyQueryBuilder().setLimit(1).build(); QueryResults queryResults = datastore.run(keyQuery); @@ -2038,7 +2029,7 @@ public void testSetLimit() { } @Test - public void testGqlQueryWithNullBinding() { + void testGqlQueryWithNullBinding() { Query query = Query.newGqlQueryBuilder(ResultType.ENTITY, "select * from " + KIND1) .setNamespace(NAMESPACE) @@ -2051,7 +2042,7 @@ public void testGqlQueryWithNullBinding() { } @Test - public void testQueryWithStartCursor() { + void testQueryWithStartCursor() { Entity entity1 = Entity.newBuilder( Key.newBuilder(PROJECT_ID, KIND1, "name-01", options.getDatabaseId()).build()) @@ -2078,7 +2069,7 @@ public void testQueryWithStartCursor() { } @Test - public void testQueryWithReadTime() throws InterruptedException { + void testQueryWithReadTime() throws InterruptedException { Entity entity1 = Entity.newBuilder( Key.newBuilder(PROJECT_ID, "new_kind", "name-01") diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreConceptsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreConceptsTest.java index 1d6b2f838..d5e758f58 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreConceptsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreConceptsTest.java @@ -15,12 +15,12 @@ */ package com.google.cloud.datastore.it; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +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.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.Timestamp; import com.google.cloud.datastore.Cursor; @@ -66,15 +66,15 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /* * Test created based on ConceptsTest to run against GraalVM checks */ -public class ITDatastoreConceptsTest { +class ITDatastoreConceptsTest { private static final RemoteDatastoreHelper HELPER = RemoteDatastoreHelper.create(); private static final DatastoreOptions OPTIONS = HELPER.getOptions(); private static final FullEntity TEST_FULL_ENTITY = FullEntity.newBuilder().build(); @@ -89,14 +89,14 @@ public class ITDatastoreConceptsTest { private static final String TASK_CONCEPTS = "TaskConcepts"; /** Initializes Datastore for testing. */ - @BeforeClass - public static void beforeClass() throws Exception { + @BeforeAll + static void beforeClass() throws Exception { datastore = OPTIONS.getService(); } /** Cleans out any residual values. Also initializes global variables used for testing. */ - @Before - public void setUp() { + @BeforeEach + void setUp() { StructuredQuery query = Query.newKeyQueryBuilder().build(); QueryResults result = datastore.run(query); datastore.delete(Iterators.toArray(result, Key.class)); @@ -124,8 +124,8 @@ public void setUp() { setUpQueryTests(); } - @After - public void tearDown() { + @AfterEach + void tearDown() { KeyQuery taskQuery = Query.newKeyQueryBuilder().setKind(TASK_CONCEPTS).build(); Key[] taskKeysToDelete = Iterators.toArray(datastore.run(taskQuery), Key.class); datastore.delete(taskKeysToDelete); @@ -189,11 +189,7 @@ private void assertValidQuery(Query query) { } private void assertInvalidQuery(Query query) { - try { - datastore.run(query); - fail("should not reach here"); - } catch (DatastoreException ignored) { - } + assertThrows(DatastoreException.class, () -> datastore.run(query)); } private List setUpTransferTests() { @@ -211,20 +207,20 @@ private void assertSuccessfulTransfer(Key from, Key to) { } @Test - public void testIncompleteKey() { + void testIncompleteKey() { KeyFactory keyFactory = datastore.newKeyFactory().setKind(TASK_CONCEPTS); Key taskKey = datastore.allocateId(keyFactory.newKey()); assertValidKey(taskKey); } @Test - public void testNamedKey() { + void testNamedKey() { Key taskKey = datastore.newKeyFactory().setKind(TASK_CONCEPTS).newKey("sampleTask"); assertValidKey(taskKey); } @Test - public void testKeyWithParent() { + void testKeyWithParent() { Key taskKey = datastore .newKeyFactory() @@ -235,7 +231,7 @@ public void testKeyWithParent() { } @Test - public void testKeyWithMultilevelParent() { + void testKeyWithMultilevelParent() { KeyFactory keyFactory = datastore .newKeyFactory() @@ -246,7 +242,7 @@ public void testKeyWithMultilevelParent() { } @Test - public void testEntityWithParent() { + void testEntityWithParent() { Key taskKey = datastore .newKeyFactory() @@ -264,7 +260,7 @@ public void testEntityWithParent() { } @Test - public void testProperties() { + void testProperties() { Entity task = Entity.newBuilder(taskKey) .set("category", "Personal") @@ -280,7 +276,7 @@ public void testProperties() { } @Test - public void testArrayValue() { + void testArrayValue() { Entity task = Entity.newBuilder(taskKey) .set("tags", "fun", "programming") @@ -290,7 +286,7 @@ public void testArrayValue() { } @Test - public void testBasicEntity() { + void testBasicEntity() { Key taskKey = datastore.newKeyFactory().setKind(TASK_CONCEPTS).newKey("sampleTask"); Entity task = Entity.newBuilder(taskKey) @@ -303,27 +299,27 @@ public void testBasicEntity() { } @Test - public void testUpsert() { + void testUpsert() { Entity task = Entity.newBuilder(keyFactory.newKey("sampleTask")).build(); datastore.put(task); assertEquals(task, datastore.get(task.getKey())); } @Test - public void testInsert() { + void testInsert() { Key taskKey = datastore.add(FullEntity.newBuilder(keyFactory.newKey()).build()).getKey(); assertEquals(FullEntity.newBuilder(taskKey).build(), datastore.get(taskKey)); } @Test - public void testLookup() { + void testLookup() { datastore.put(testEntity); Entity task = datastore.get(taskKey); assertEquals(testEntity, task); } @Test - public void testUpdate() { + void testUpdate() { datastore.put(testEntity); Entity task = Entity.newBuilder(datastore.get(taskKey)).set("priority", 5).build(); datastore.update(task); @@ -331,14 +327,14 @@ public void testUpdate() { } @Test - public void testDelete() { + void testDelete() { datastore.put(testEntity); datastore.delete(taskKey); assertNull(datastore.get(taskKey)); } @Test - public void testBatchUpsert() { + void testBatchUpsert() { FullEntity task1 = FullEntity.newBuilder(keyFactory.newKey()) .set("category", "Personal") @@ -361,7 +357,7 @@ public void testBatchUpsert() { } @Test - public void testBatchLookup() { + void testBatchLookup() { Key taskKey1 = keyFactory.newKey(1); Key taskKey2 = keyFactory.newKey(2); List expectedTasks = setUpBatchTests(taskKey1, taskKey2); @@ -371,7 +367,7 @@ public void testBatchLookup() { } @Test - public void testBatchDelete() { + void testBatchDelete() { Key taskKey1 = keyFactory.newKey(1); Key taskKey2 = keyFactory.newKey(2); setUpBatchTests(taskKey1, taskKey2); @@ -381,7 +377,7 @@ public void testBatchDelete() { } @Test - public void testBasicQuery() { + void testBasicQuery() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -394,7 +390,7 @@ public void testBasicQuery() { } @Test - public void testRunQuery() { + void testRunQuery() { Query query = Query.newEntityQueryBuilder().setKind(TASK_CONCEPTS).build(); QueryResults tasks = datastore.run(query); assertNotNull(tasks.next()); @@ -402,7 +398,7 @@ public void testRunQuery() { } @Test - public void testPropertyFilter() { + void testPropertyFilter() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -412,7 +408,7 @@ public void testPropertyFilter() { } @Test - public void testCompositeFilter() { + void testCompositeFilter() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -424,7 +420,7 @@ public void testCompositeFilter() { } @Test - public void testKeyFilter() { + void testKeyFilter() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -434,7 +430,7 @@ public void testKeyFilter() { } @Test - public void testAscendingSort() { + void testAscendingSort() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -444,7 +440,7 @@ public void testAscendingSort() { } @Test - public void testDescendingSort() { + void testDescendingSort() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -454,7 +450,7 @@ public void testDescendingSort() { } @Test - public void testMultiSort() { + void testMultiSort() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -464,7 +460,7 @@ public void testMultiSort() { } @Test - public void testKindlessQuery() { + void testKindlessQuery() { Key lastSeenKey = keyFactory.newKey("a"); Query query = @@ -473,7 +469,7 @@ public void testKindlessQuery() { } @Test - public void testAncestorQuery() { + void testAncestorQuery() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -485,7 +481,7 @@ public void testAncestorQuery() { } @Test - public void testProjectionQuery() { + void testProjectionQuery() { Query query = Query.newProjectionEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -495,7 +491,7 @@ public void testProjectionQuery() { } @Test - public void testRunProjectionQuery() { + void testRunProjectionQuery() { Query query = Query.newProjectionEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -514,13 +510,13 @@ public void testRunProjectionQuery() { } @Test - public void testKeysOnlyQuery() { + void testKeysOnlyQuery() { Query query = Query.newKeyQueryBuilder().setKind(TASK_CONCEPTS).build(); assertValidQuery(query); } @Test - public void testDistinctOnQuery() { + void testDistinctOnQuery() { Query query = Query.newProjectionEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -532,7 +528,7 @@ public void testDistinctOnQuery() { } @Test - public void testArrayValueInequalityRange() { + void testArrayValueInequalityRange() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -545,7 +541,7 @@ public void testArrayValueInequalityRange() { } @Test - public void testArrayValueEquality() { + void testArrayValueEquality() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -557,7 +553,7 @@ public void testArrayValueEquality() { } @Test - public void testInequalityRange() { + void testInequalityRange() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -569,7 +565,7 @@ public void testInequalityRange() { } @Test - public void testInequalityValid() { + void testInequalityValid() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -581,7 +577,7 @@ public void testInequalityValid() { } @Test - public void testEqualAndInequalityRange() { + void testEqualAndInequalityRange() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -595,7 +591,7 @@ public void testEqualAndInequalityRange() { } @Test - public void testInequalitySort() { + void testInequalitySort() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -606,7 +602,7 @@ public void testInequalitySort() { } @Test - public void testInequalitySortInvalidNotSame() { + void testInequalitySortInvalidNotSame() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -617,7 +613,7 @@ public void testInequalitySortInvalidNotSame() { } @Test - public void testInequalitySortInvalidNotFirst() { + void testInequalitySortInvalidNotFirst() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -628,13 +624,13 @@ public void testInequalitySortInvalidNotFirst() { } @Test - public void testLimit() { + void testLimit() { Query query = Query.newEntityQueryBuilder().setKind(TASK_CONCEPTS).setLimit(5).build(); assertValidQuery(query); } @Test - public void testCursorPaging() { + void testCursorPaging() { datastore.put(testEntity); Cursor nextPageCursor = cursorPaging(1, null); assertNotNull(nextPageCursor); @@ -658,7 +654,7 @@ private Cursor cursorPaging(int pageSize, Cursor pageCursor) { } @Test - public void testEventualConsistentQuery() { + void testEventualConsistentQuery() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -671,7 +667,7 @@ public void testEventualConsistentQuery() { } @Test - public void testUnindexedPropertyQuery() { + void testUnindexedPropertyQuery() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -682,7 +678,7 @@ public void testUnindexedPropertyQuery() { } @Test - public void testExplodingProperties() { + void testExplodingProperties() { Entity task = Entity.newBuilder(taskKey) .set("tags", "fun", "programming", "learn") @@ -693,7 +689,7 @@ public void testExplodingProperties() { } @Test - public void testTransactionalUpdate() { + void testTransactionalUpdate() { List keys = setUpTransferTests(); transferFunds(keys.get(0), keys.get(1), 10); assertSuccessfulTransfer(keys.get(0), keys.get(1)); @@ -719,7 +715,7 @@ void transferFunds(Key fromKey, Key toKey, long amount) { } @Test - public void testTransactionalRetry() { + void testTransactionalRetry() { List keys = setUpTransferTests(); Key fromKey = keys.get(0); Key toKey = keys.get(1); @@ -739,7 +735,7 @@ public void testTransactionalRetry() { } @Test - public void testTransactionalGetOrCreate() { + void testTransactionalGetOrCreate() { Entity task; Transaction txn = datastore.newTransaction(); try { @@ -758,7 +754,7 @@ public void testTransactionalGetOrCreate() { } @Test - public void testTransactionalSingleEntityGroupReadOnly() { + void testTransactionalSingleEntityGroupReadOnly() { Key taskListKey = datastore.newKeyFactory().setKind("TaskList").newKey("default"); Entity taskListEntity = Entity.newBuilder(taskListKey).build(); @@ -788,7 +784,7 @@ public void testTransactionalSingleEntityGroupReadOnly() { } @Test - public void testNamespaceRunQuery() { + void testNamespaceRunQuery() { KeyFactory keyFactory = datastore.newKeyFactory().setKind("__namespace__"); Key namespaceKey = keyFactory.newKey(OPTIONS.getNamespace()); Query query = @@ -805,7 +801,7 @@ public void testNamespaceRunQuery() { } @Test - public void testKindRunQuery() { + void testKindRunQuery() { Query query = Query.newKeyQueryBuilder().setKind("__kind__").build(); List kinds = new ArrayList<>(); QueryResults results = datastore.run(query); @@ -816,7 +812,7 @@ public void testKindRunQuery() { } @Test - public void testPropertyRunQuery() { + void testPropertyRunQuery() { Query query = Query.newKeyQueryBuilder().setKind("__property__").build(); QueryResults keys = datastore.run(query); Map> propertiesByKind = new HashMap<>(); @@ -836,7 +832,7 @@ public void testPropertyRunQuery() { } @Test - public void testPropertyByKindRunQuery() { + void testPropertyByKindRunQuery() { Key key = datastore.newKeyFactory().setKind("__kind__").newKey(TASK_CONCEPTS); Query query = Query.newEntityQueryBuilder() @@ -869,7 +865,7 @@ public void testPropertyByKindRunQuery() { } @Test - public void testPropertyFilteringRunQuery() { + void testPropertyFilteringRunQuery() { Key startKey = datastore .newKeyFactory() @@ -896,7 +892,7 @@ public void testPropertyFilteringRunQuery() { } @Test - public void testEqQuerySorted() { + void testEqQuerySorted() { Query query = Query.newEntityQueryBuilder() .setKind(TASK_CONCEPTS) @@ -929,7 +925,7 @@ private void setUpQueryTestsRealBackend() { } @Test - public void testInQuery() { + void testInQuery() { setUpQueryTestsRealBackend(); Query query = Query.newEntityQueryBuilder() @@ -940,7 +936,7 @@ public void testInQuery() { } @Test - public void testNotEqualsQuery() { + void testNotEqualsQuery() { setUpQueryTestsRealBackend(); Query query = Query.newEntityQueryBuilder() @@ -951,7 +947,7 @@ public void testNotEqualsQuery() { } @Test - public void testNotInQuery() { + void testNotInQuery() { setUpQueryTestsRealBackend(); Query query = Query.newEntityQueryBuilder() @@ -962,7 +958,7 @@ public void testNotInQuery() { } @Test - public void testInQuerySorted() { + void testInQuerySorted() { setUpQueryTestsRealBackend(); Query query = Query.newEntityQueryBuilder() @@ -974,7 +970,7 @@ public void testInQuerySorted() { } @Test - public void testStaleReads() throws InterruptedException { + void testStaleReads() throws InterruptedException { setUpQueryTestsRealBackend(); // waiting for 6 seconds, so that we can query with read time of 5 seconds ago TimeUnit.SECONDS.sleep(6); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestGrpc.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestGrpc.java index 7bb809997..4c9fa887f 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestGrpc.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestGrpc.java @@ -20,45 +20,23 @@ import com.google.cloud.datastore.testing.RemoteDatastoreHelper; import com.google.cloud.grpc.GrpcTransportOptions; import com.google.common.truth.Truth; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import org.junit.jupiter.api.AfterAll; -@RunWith(Parameterized.class) -public class ITDatastoreTestGrpc extends AbstractITDatastoreTest { +class ITDatastoreTestGrpc extends AbstractITDatastoreTest { // setup for default db, grpc transport protected static final RemoteDatastoreHelper HELPER_DEFAULT_GRPC = RemoteDatastoreHelper.create(GrpcTransportOptions.newBuilder().build()); private static final DatastoreOptions OPTIONS_DEFAULT_GRPC = HELPER_DEFAULT_GRPC.getOptions(); private static final Datastore DATASTORE_DEFAULT_GRPC = OPTIONS_DEFAULT_GRPC.getService(); - // setup for custom db, grpc transport - private static final RemoteDatastoreHelper HELPER_CUSTOM_DB_GRPC = - RemoteDatastoreHelper.create(CUSTOM_DB_ID, GrpcTransportOptions.newBuilder().build()); - private static final DatastoreOptions OPTIONS_CUSTOM_DB_GRPC = HELPER_CUSTOM_DB_GRPC.getOptions(); - private static final Datastore DATASTORE_CUSTOM_DB_GRPC = OPTIONS_CUSTOM_DB_GRPC.getService(); - - public ITDatastoreTestGrpc(DatastoreOptions options, Datastore datastore, String databaseType) { - super(options, datastore, databaseType); - } - - @Parameterized.Parameters(name = "database: {2}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {OPTIONS_DEFAULT_GRPC, DATASTORE_DEFAULT_GRPC, "default"}, - {OPTIONS_CUSTOM_DB_GRPC, DATASTORE_CUSTOM_DB_GRPC, CUSTOM_DB_ID}, - }); + public ITDatastoreTestGrpc() { + super(OPTIONS_DEFAULT_GRPC, DATASTORE_DEFAULT_GRPC, "default"); } - @AfterClass - public static void afterClass() throws Exception { + @AfterAll + static void afterClass() throws Exception { HELPER_DEFAULT_GRPC.deleteNamespace(); - HELPER_CUSTOM_DB_GRPC.deleteNamespace(); DATASTORE_DEFAULT_GRPC.close(); - DATASTORE_CUSTOM_DB_GRPC.close(); Truth.assertThat(DATASTORE_DEFAULT_GRPC.isClosed()).isTrue(); - Truth.assertThat(DATASTORE_CUSTOM_DB_GRPC.isClosed()).isTrue(); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestHttp.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestHttp.java index 3546bfcaf..ebc188f86 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestHttp.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITDatastoreTestHttp.java @@ -18,41 +18,21 @@ import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.DatastoreOptions; import com.google.cloud.datastore.testing.RemoteDatastoreHelper; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import org.junit.jupiter.api.AfterAll; -@RunWith(Parameterized.class) -public class ITDatastoreTestHttp extends AbstractITDatastoreTest { +class ITDatastoreTestHttp extends AbstractITDatastoreTest { // setup for default db, http transport private static final RemoteDatastoreHelper HELPER_DEFAULT_HTTP = RemoteDatastoreHelper.create(); private static final DatastoreOptions OPTIONS_DEFAULT_HTTP = HELPER_DEFAULT_HTTP.getOptions(); private static final Datastore DATASTORE_DEFAULT_HTTP = OPTIONS_DEFAULT_HTTP.getService(); - // setup for custom db, http transport - private static final RemoteDatastoreHelper HELPER_CUSTOM_DB_HTTP = - RemoteDatastoreHelper.create(CUSTOM_DB_ID); - private static final DatastoreOptions OPTIONS_CUSTOM_DB_HTTP = HELPER_CUSTOM_DB_HTTP.getOptions(); - private static final Datastore DATASTORE_CUSTOM_DB_HTTP = OPTIONS_CUSTOM_DB_HTTP.getService(); - - public ITDatastoreTestHttp(DatastoreOptions options, Datastore datastore, String databaseType) { - super(options, datastore, databaseType); - } - - @Parameterized.Parameters(name = "database: {2}") - public static Iterable data() { - return Arrays.asList( - new Object[][] { - {OPTIONS_DEFAULT_HTTP, DATASTORE_DEFAULT_HTTP, "default"}, - {OPTIONS_CUSTOM_DB_HTTP, DATASTORE_CUSTOM_DB_HTTP, CUSTOM_DB_ID}, - }); + public ITDatastoreTestHttp() { + super(OPTIONS_DEFAULT_HTTP, DATASTORE_DEFAULT_HTTP, "default"); } - @AfterClass - public static void afterClass() throws Exception { + @AfterAll + static void afterClass() throws Exception { HELPER_DEFAULT_HTTP.deleteNamespace(); - HELPER_CUSTOM_DB_HTTP.deleteNamespace(); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java index d0631f51a..1e6db8ffb 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java @@ -31,11 +31,11 @@ import static com.google.cloud.datastore.telemetry.TraceUtil.SPAN_NAME_TRANSACTION_RUN_QUERY; import static com.google.common.truth.Truth.assertThat; import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_NAME; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -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.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.api.gax.rpc.NotFoundException; import com.google.cloud.datastore.AggregationQuery; @@ -60,8 +60,6 @@ import com.google.common.base.Preconditions; import com.google.devtools.cloudtrace.v1.Trace; import com.google.devtools.cloudtrace.v1.TraceSpan; -import com.google.testing.junit.testparameterinjector.TestParameter; -import com.google.testing.junit.testparameterinjector.TestParameterInjector; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanContext; @@ -87,12 +85,11 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; // This End-to-End test verifies Client-side Tracing Functionality instrumented using the // OpenTelemetry API. @@ -113,15 +110,14 @@ // 4. Datastore operations are run inside a root TraceSpan created using the custom SpanContext from // (3). // 5. Traces are read-back using TraceServiceClient and verified against expected Call Stacks. -@RunWith(TestParameterInjector.class) -public class ITE2ETracingTest { +class ITE2ETracingTest { protected boolean isUsingGlobalOpenTelemetrySDK() { - return useGlobalOpenTelemetrySDK; + return true; } protected String datastoreNamedDatabase() { - return datastoreNamedDatabase; + return ""; } // Helper class to track call-stacks in a trace @@ -267,17 +263,12 @@ private boolean dfsContainsCallStack(long spanId, List expectedCallStack private static RemoteDatastoreHelper remoteDatastoreHelper; - @TestParameter boolean useGlobalOpenTelemetrySDK; + boolean useGlobalOpenTelemetrySDK; - @TestParameter({ - /*(default)*/ - "", - "test-db" - }) String datastoreNamedDatabase; - @BeforeClass - public static void setup() throws IOException { + @BeforeAll + static void setup() throws IOException { projectId = DatastoreOptions.getDefaultProjectId(); traceExporter = TraceExporter.createWithConfiguration( @@ -286,8 +277,8 @@ public static void setup() throws IOException { random = new Random(); } - @Before - public void before() throws Exception { + @BeforeEach + void before() throws Exception { // Set up OTel SDK Resource resource = Resource.getDefault().merge(Resource.builder().put(SERVICE_NAME, "Sparky").build()); @@ -365,8 +356,8 @@ public void before() throws Exception { assertNull(retrievedTrace); } - @After - public void after() throws Exception { + @AfterEach + void after() throws Exception { if (isUsingGlobalOpenTelemetrySDK()) { GlobalOpenTelemetry.resetForTest(); } @@ -378,8 +369,8 @@ public void after() throws Exception { openTelemetrySdk = null; } - @AfterClass - public static void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { traceClient_v1.close(); } @@ -506,7 +497,7 @@ protected void fetchAndValidateTrace(String traceId, String... spanNames) } @Test - public void traceContainerTest() throws Exception { + void traceContainerTest() throws Exception { // Make sure the test has a new SpanContext (and TraceId for injection) assertNotNull(customSpanContext); @@ -561,7 +552,7 @@ public void traceContainerTest() throws Exception { } @Test - public void lookupTraceTest() throws Exception { + void lookupTraceTest() throws Exception { // Make sure the test has a new SpanContext (and TraceId for injection) assertNotNull(customSpanContext); @@ -579,7 +570,7 @@ public void lookupTraceTest() throws Exception { } @Test - public void allocateIdsTraceTest() throws Exception { + void allocateIdsTraceTest() throws Exception { assertNotNull(customSpanContext); Span rootSpan = getNewRootSpanWithContext(); @@ -604,7 +595,7 @@ public void allocateIdsTraceTest() throws Exception { } @Test - public void reserveIdsTraceTest() throws Exception { + void reserveIdsTraceTest() throws Exception { assertNotNull(customSpanContext); Span rootSpan = getNewRootSpanWithContext(); @@ -623,7 +614,7 @@ public void reserveIdsTraceTest() throws Exception { } @Test - public void commitTraceTest() throws Exception { + void commitTraceTest() throws Exception { assertNotNull(customSpanContext); Span rootSpan = getNewRootSpanWithContext(); @@ -641,7 +632,7 @@ public void commitTraceTest() throws Exception { } @Test - public void putTraceTest() throws Exception { + void putTraceTest() throws Exception { assertNotNull(customSpanContext); Span rootSpan = getNewRootSpanWithContext(); @@ -659,7 +650,7 @@ public void putTraceTest() throws Exception { } @Test - public void updateTraceTest() throws Exception { + void updateTraceTest() throws Exception { assertNotNull(customSpanContext); Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); @@ -687,7 +678,7 @@ public void updateTraceTest() throws Exception { } @Test - public void deleteTraceTest() throws Exception { + void deleteTraceTest() throws Exception { assertNotNull(customSpanContext); Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); @@ -706,7 +697,7 @@ public void deleteTraceTest() throws Exception { } @Test - public void runQueryTraceTest() throws Exception { + void runQueryTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); List entityList = new ArrayList<>(); @@ -734,7 +725,7 @@ public void runQueryTraceTest() throws Exception { } @Test - public void runAggregationQueryTraceTest() throws Exception { + void runAggregationQueryTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1) .set("pepper_name", "jalapeno") @@ -792,7 +783,7 @@ public void runAggregationQueryTraceTest() throws Exception { } @Test - public void newTransactionReadTest() throws Exception { + void newTransactionReadTest() throws Exception { assertNotNull(customSpanContext); Span rootSpan = getNewRootSpanWithContext(); @@ -816,7 +807,7 @@ public void newTransactionReadTest() throws Exception { } @Test - public void newTransactionQueryTest() throws Exception { + void newTransactionQueryTest() throws Exception { // Set up Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); @@ -856,7 +847,7 @@ public void newTransactionQueryTest() throws Exception { } @Test - public void newTransactionReadWriteTraceTest() throws Exception { + void newTransactionReadWriteTraceTest() throws Exception { // Set up Entity entity1 = Entity.newBuilder(KEY1).set("pepper_type", "jalapeno").build(); Entity entity2 = Entity.newBuilder(KEY2).set("pepper_type", "habanero").build(); @@ -911,7 +902,7 @@ public void newTransactionReadWriteTraceTest() throws Exception { } @Test - public void newTransactionRollbackTest() throws Exception { + void newTransactionRollbackTest() throws Exception { // Set up Entity entity1 = Entity.newBuilder(KEY1).set("pepper_type", "jalapeno").build(); Entity entity2 = Entity.newBuilder(KEY2).set("pepper_type", "habanero").build(); @@ -966,7 +957,7 @@ public void newTransactionRollbackTest() throws Exception { } @Test - public void runInTransactionQueryTest() throws Exception { + void runInTransactionQueryTest() throws Exception { // Set up Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java index aefb51352..442e9fd7d 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java @@ -20,11 +20,11 @@ import static com.google.cloud.datastore.telemetry.TraceUtil.*; import static com.google.common.truth.Truth.assertThat; import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_NAME; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -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.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.cloud.datastore.AggregationQuery; import com.google.cloud.datastore.AggregationResult; @@ -69,16 +69,13 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; @RunWith(TestParameterInjector.class) -public class ITTracingTest { +class ITTracingTest { protected boolean isUsingGlobalOpenTelemetrySDK() { return useGlobalOpenTelemetrySDK; } @@ -126,10 +123,8 @@ protected String datastoreNamedDatabase() { Map spanIdToParentSpanId = new HashMap<>(); Map spanNameToSpanData = new HashMap<>(); - @Rule public TestName testName = new TestName(); - - @Before - public void before() { + @BeforeEach + void before() { inMemorySpanExporter = InMemorySpanExporter.create(); Resource resource = @@ -189,8 +184,8 @@ public void before() { cleanupTestSpanContext(); } - @After - public void after() throws Exception { + @AfterEach + void after() throws Exception { if (isUsingGlobalOpenTelemetrySDK()) { GlobalOpenTelemetry.resetForTest(); } @@ -202,9 +197,6 @@ public void after() throws Exception { openTelemetrySdk = null; } - @AfterClass - public static void teardown() {} - void waitForTracesToComplete() throws Exception { // The same way that querying the Cloud Trace backend may not give us the // full trace on the first try, querying the in-memory traces may not result @@ -390,7 +382,7 @@ public void setBar(int bar) { } @Test - public void lookupTraceTest() throws Exception { + void lookupTraceTest() throws Exception { Entity entity = datastore.get(KEY1); assertNull(entity); @@ -414,7 +406,7 @@ public void lookupTraceTest() throws Exception { } @Test - public void allocateIdsTraceTest() throws Exception { + void allocateIdsTraceTest() throws Exception { String kind1 = "kind1"; KeyFactory keyFactory = datastore.newKeyFactory().setKind(kind1); IncompleteKey pk1 = keyFactory.newKey(); @@ -428,7 +420,7 @@ public void allocateIdsTraceTest() throws Exception { } @Test - public void reserveIdsTraceTest() throws Exception { + void reserveIdsTraceTest() throws Exception { KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind"); Key key1 = keyFactory.newKey(10); Key key2 = keyFactory.newKey("name"); @@ -443,7 +435,7 @@ public void reserveIdsTraceTest() throws Exception { } @Test - public void commitTraceTest() throws Exception { + void commitTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); Entity response = datastore.add(entity1); assertEquals(entity1, response); @@ -456,7 +448,7 @@ public void commitTraceTest() throws Exception { } @Test - public void putTraceTest() throws Exception { + void putTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); Entity response = datastore.put(entity1); assertEquals(entity1, response); @@ -469,7 +461,7 @@ public void putTraceTest() throws Exception { } @Test - public void updateTraceTest() throws Exception { + void updateTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); List entityList = new ArrayList<>(); @@ -509,7 +501,7 @@ public void updateTraceTest() throws Exception { } @Test - public void deleteTraceTest() throws Exception { + void deleteTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); Entity response = datastore.put(entity1); assertEquals(entity1, response); @@ -553,7 +545,7 @@ public void deleteTraceTest() throws Exception { } @Test - public void runQueryTraceTest() throws Exception { + void runQueryTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); List entityList = new ArrayList<>(); @@ -595,7 +587,7 @@ public void runQueryTraceTest() throws Exception { } @Test - public void runAggregationQueryTraceTest() throws Exception { + void runAggregationQueryTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1) .set("pepper_name", "jalapeno") @@ -650,7 +642,7 @@ public void runAggregationQueryTraceTest() throws Exception { } @Test - public void newTransactionReadWriteTraceTest() throws Exception { + void newTransactionReadWriteTraceTest() throws Exception { // Transaction.Begin Transaction transaction = datastore.newTransaction(); @@ -698,7 +690,7 @@ public void newTransactionReadWriteTraceTest() throws Exception { } @Test - public void newTransactionQueryTest() throws Exception { + void newTransactionQueryTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); List entityList = new ArrayList<>(); @@ -744,7 +736,7 @@ public void newTransactionQueryTest() throws Exception { } @Test - public void newTransactionRollbackTest() throws Exception { + void newTransactionRollbackTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("pepper_type", "jalapeno").build(); Entity entity2 = Entity.newBuilder(KEY2).set("pepper_type", "habanero").build(); List entityList = new ArrayList<>(); @@ -808,7 +800,7 @@ public void newTransactionRollbackTest() throws Exception { } @Test - public void runInTransactionQueryTest() throws Exception { + void runInTransactionQueryTest() throws Exception { // Set up Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRule.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRule.java deleted file mode 100644 index ce9a226a6..000000000 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRule.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.datastore.it; - -import static com.google.common.base.Preconditions.checkState; - -import java.util.ArrayList; -import java.util.List; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.MultipleFailureException; -import org.junit.runners.model.Statement; - -/** - * A JUnit rule that allows us to allow multiple attempts of a test execution before it is - * ultimately failed. When it fails, all failures will be propagated as the result of the test. - */ -public final class MultipleAttemptsRule implements TestRule { - private final long initialBackoffMillis; - private final int attemptCount; - - MultipleAttemptsRule(int attemptCount) { - this(attemptCount, 1000L); - } - - public MultipleAttemptsRule(int attemptCount, long initialBackoffMillis) { - checkState(attemptCount > 0, "attemptCount must be > 0"); - checkState(initialBackoffMillis > 0, "initialBackoffMillis must be > 0"); - this.initialBackoffMillis = initialBackoffMillis; - this.attemptCount = attemptCount; - } - - @Override - public Statement apply(final Statement base, Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - List failures = new ArrayList<>(); - - long retryIntervalMillis = initialBackoffMillis; - - for (int i = 1; i <= attemptCount; i++) { - try { - base.evaluate(); - return; - } catch (Throwable t) { - failures.add(t); - Thread.sleep(retryIntervalMillis); - retryIntervalMillis *= 1.5f; - } - } - - MultipleFailureException.assertEmpty(failures); - } - }; - } -} diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRuleTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRuleTest.java index bb6a3c2f5..9f548f9f7 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRuleTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/MultipleAttemptsRuleTest.java @@ -16,22 +16,33 @@ package com.google.cloud.datastore.it; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.Rule; -import org.junit.Test; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.Test; -public final class MultipleAttemptsRuleTest { +final class MultipleAttemptsRuleTest { private static final int NUMBER_OF_ATTEMPTS = 5; - @Rule public MultipleAttemptsRule rr = new MultipleAttemptsRule(NUMBER_OF_ATTEMPTS, 10); - - private int numberAttempted = 0; + private final AtomicInteger numberAttempted = new AtomicInteger(); @Test - public void wontPassUntil5() { - numberAttempted += 1; - assertEquals(NUMBER_OF_ATTEMPTS, numberAttempted); + void wontPassUntil5() { + assertThrows( + AssertionError.class, + () -> { + for (int i = 0; i < NUMBER_OF_ATTEMPTS; i++) { + int currentAttempt = numberAttempted.incrementAndGet(); + if (currentAttempt < NUMBER_OF_ATTEMPTS) { + assertEquals( + NUMBER_OF_ATTEMPTS, currentAttempt); // This will fail until the last attempt + } else { + assertEquals( + NUMBER_OF_ATTEMPTS, currentAttempt); // This will pass on the last attempt + } + } + }); } } diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java index a0e778cee..c6e9f9df2 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExecutionStatsTest.java @@ -21,9 +21,9 @@ import com.google.protobuf.Duration; import com.google.protobuf.Struct; import com.google.protobuf.Value; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ExecutionStatsTest { +class ExecutionStatsTest { private final Struct struct = Struct.newBuilder() .putFields("key", Value.newBuilder().setStringValue("val").build()) @@ -39,7 +39,7 @@ public class ExecutionStatsTest { ExecutionStats executionStats = new ExecutionStats(proto); @Test - public void testModel() { + void testModel() { Truth.assertThat(executionStats.getDebugStats()).isEqualTo(Structs.asMap(struct)); Truth.assertThat(executionStats.getExecutionDurationJavaTime()) .isEqualTo(java.time.Duration.ofNanos(duration.getNanos())); @@ -48,7 +48,7 @@ public void testModel() { } @Test - public void testEqualsAndHashcode() { + void testEqualsAndHashcode() { com.google.datastore.v1.ExecutionStats proto2 = com.google.datastore.v1.ExecutionStats.newBuilder() .setDebugStats(struct) diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExplainOptionsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExplainOptionsTest.java index f8fb86abf..ff0f73880 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExplainOptionsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/ExplainOptionsTest.java @@ -17,11 +17,11 @@ import com.google.common.testing.EqualsTester; import com.google.common.truth.Truth; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ExplainOptionsTest { +class ExplainOptionsTest { @Test - public void testModel() { + void testModel() { com.google.datastore.v1.ExplainOptions builtProto = com.google.datastore.v1.ExplainOptions.newBuilder().setAnalyze(true).build(); @@ -46,7 +46,7 @@ public void testModel() { } @Test - public void testEqualsAndHashcode() { + void testEqualsAndHashcode() { ExplainOptions explainOptions = ExplainOptions.newBuilder().build(); ExplainOptions explainOptions2 = ExplainOptions.newBuilder().setAnalyze(true).build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/PlanSummaryTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/PlanSummaryTest.java index fe8c0f0d6..58f0319e4 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/PlanSummaryTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/models/PlanSummaryTest.java @@ -21,9 +21,9 @@ import com.google.common.truth.Truth; import com.google.protobuf.Struct; import com.google.protobuf.Value; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class PlanSummaryTest { +class PlanSummaryTest { private final Struct struct1 = Struct.newBuilder() .putFields("key", Value.newBuilder().setStringValue("val").build()) @@ -41,14 +41,14 @@ public class PlanSummaryTest { private final PlanSummary planSummary = new PlanSummary(proto); @Test - public void testModel() { + void testModel() { Truth.assertThat(planSummary.getIndexesUsed()) .isEqualTo(Lists.newArrayList(Structs.asMap(struct1), Structs.asMap(struct2))); Truth.assertThat(planSummary.getIndexesUsed().get(0).get("key")).isEqualTo("val"); } @Test - public void testEqualsAndHashcode() { + void testEqualsAndHashcode() { com.google.datastore.v1.PlanSummary proto2 = com.google.datastore.v1.PlanSummary.newBuilder().addIndexesUsed(struct1).build(); PlanSummary planSummary2 = new PlanSummary(proto2); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java index f81348257..79f0fe625 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/spi/v1/RpcUtilsTest.java @@ -22,12 +22,12 @@ import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.datastore.DatastoreOptions; import java.time.Duration; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class RpcUtilsTest { +class RpcUtilsTest { @Test - public void testRetrySettingSetter() { + void testRetrySettingSetter() { UnaryCallSettings.Builder builder = UnaryCallSettings.newUnaryCallSettingsBuilder(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/DisabledTraceUtilTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/DisabledTraceUtilTest.java index c80ef9353..163e1c35b 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/DisabledTraceUtilTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/DisabledTraceUtilTest.java @@ -17,23 +17,23 @@ import static com.google.common.truth.Truth.assertThat; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class DisabledTraceUtilTest { +class DisabledTraceUtilTest { @Test - public void disabledTraceUtilDoesNotProvideChannelConfigurator() { + void disabledTraceUtilDoesNotProvideChannelConfigurator() { DisabledTraceUtil traceUtil = new DisabledTraceUtil(); assertThat(traceUtil.getChannelConfigurator()).isNull(); } @Test - public void usesDisabledContext() { + void usesDisabledContext() { DisabledTraceUtil traceUtil = new DisabledTraceUtil(); assertThat(traceUtil.getCurrentContext() instanceof DisabledTraceUtil.Context).isTrue(); } @Test - public void usesDisabledSpan() { + void usesDisabledSpan() { DisabledTraceUtil traceUtil = new DisabledTraceUtil(); assertThat(traceUtil.getCurrentSpan() instanceof DisabledTraceUtil.Span).isTrue(); assertThat(traceUtil.startSpan("foo") instanceof DisabledTraceUtil.Span).isTrue(); @@ -44,7 +44,7 @@ public void usesDisabledSpan() { } @Test - public void usesDisabledScope() { + void usesDisabledScope() { DisabledTraceUtil traceUtil = new DisabledTraceUtil(); assertThat(traceUtil.getCurrentContext().makeCurrent() instanceof DisabledTraceUtil.Scope) .isTrue(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/EnabledTraceUtilTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/EnabledTraceUtilTest.java index f076c0966..5c6f58e67 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/EnabledTraceUtilTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/EnabledTraceUtilTest.java @@ -22,12 +22,12 @@ import com.google.cloud.datastore.DatastoreOptions; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.sdk.OpenTelemetrySdk; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class EnabledTraceUtilTest { - @Before - public void setUp() { +class EnabledTraceUtilTest { + @BeforeEach + void setUp() { GlobalOpenTelemetry.resetForTest(); } @@ -49,7 +49,7 @@ EnabledTraceUtil newEnabledTraceUtil() { } @Test - public void usesOpenTelemetryFromOptions() { + void usesOpenTelemetryFromOptions() { OpenTelemetrySdk myOpenTelemetrySdk = OpenTelemetrySdk.builder().build(); DatastoreOptions firestoreOptions = getBaseOptions() @@ -64,7 +64,7 @@ public void usesOpenTelemetryFromOptions() { } @Test - public void usesGlobalOpenTelemetryIfOpenTelemetryInstanceNotProvided() { + void usesGlobalOpenTelemetryIfOpenTelemetryInstanceNotProvided() { OpenTelemetrySdk ignored = OpenTelemetrySdk.builder().buildAndRegisterGlobal(); DatastoreOptions datastoreOptions = getBaseOptions() @@ -76,12 +76,12 @@ public void usesGlobalOpenTelemetryIfOpenTelemetryInstanceNotProvided() { } @Test - public void enabledTraceUtilProvidesChannelConfigurator() { + void enabledTraceUtilProvidesChannelConfigurator() { assertThat(newEnabledTraceUtil().getChannelConfigurator()).isNull(); } @Test - public void openTelemetryInstanceRegistersGrpcChannelConfigurator() { + void openTelemetryInstanceRegistersGrpcChannelConfigurator() { OpenTelemetrySdk myOpenTelemetrySdk = OpenTelemetrySdk.builder().build(); DatastoreOptions firestoreOptions = getBaseOptions() @@ -96,7 +96,7 @@ public void openTelemetryInstanceRegistersGrpcChannelConfigurator() { } @Test - public void globalOpenTelemetryRegistersGrpcChannelConfigurator() { + void globalOpenTelemetryRegistersGrpcChannelConfigurator() { OpenTelemetrySdk.builder().buildAndRegisterGlobal(); DatastoreOptions datastoreOptions = @@ -109,13 +109,13 @@ public void globalOpenTelemetryRegistersGrpcChannelConfigurator() { } @Test - public void usesEnabledContext() { + void usesEnabledContext() { assertThat(newEnabledTraceUtil().getCurrentContext() instanceof EnabledTraceUtil.Context) .isTrue(); } @Test - public void usesEnabledSpan() { + void usesEnabledSpan() { EnabledTraceUtil traceUtil = newEnabledTraceUtil(); assertThat(traceUtil.getCurrentSpan() instanceof EnabledTraceUtil.Span).isTrue(); assertThat(traceUtil.startSpan("foo") != null).isTrue(); @@ -125,7 +125,7 @@ public void usesEnabledSpan() { } @Test - public void usesEnabledScope() { + void usesEnabledScope() { EnabledTraceUtil traceUtil = newEnabledTraceUtil(); assertThat(traceUtil.getCurrentContext().makeCurrent() instanceof EnabledTraceUtil.Scope) .isTrue(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/TraceUtilTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/TraceUtilTest.java index f1cce8006..1e0da86d4 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/TraceUtilTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/telemetry/TraceUtilTest.java @@ -20,11 +20,11 @@ import com.google.cloud.NoCredentials; import com.google.cloud.datastore.DatastoreOpenTelemetryOptions; import com.google.cloud.datastore.DatastoreOptions; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class TraceUtilTest { +class TraceUtilTest { @Test - public void defaultOptionsUseDisabledTraceUtil() { + void defaultOptionsUseDisabledTraceUtil() { TraceUtil traceUtil = TraceUtil.getInstance( DatastoreOptions.newBuilder() @@ -35,7 +35,7 @@ public void defaultOptionsUseDisabledTraceUtil() { } @Test - public void tracingDisabledOptionsUseDisabledTraceUtil() { + void tracingDisabledOptionsUseDisabledTraceUtil() { TraceUtil traceUtil = TraceUtil.getInstance( DatastoreOptions.newBuilder() @@ -48,7 +48,7 @@ public void tracingDisabledOptionsUseDisabledTraceUtil() { } @Test - public void tracingEnabledOptionsUseEnabledTraceUtil() { + void tracingEnabledOptionsUseEnabledTraceUtil() { TraceUtil traceUtil = TraceUtil.getInstance( DatastoreOptions.newBuilder() diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java index 3b07254d7..e0bcfbe61 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/testing/ITLocalDatastoreHelperTest.java @@ -17,12 +17,13 @@ package com.google.cloud.datastore.testing; import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -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.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.cloud.NoCredentials; @@ -38,33 +39,29 @@ import java.nio.file.Path; import java.time.Duration; import java.util.concurrent.TimeoutException; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@RunWith(JUnit4.class) -public class ITLocalDatastoreHelperTest { +class ITLocalDatastoreHelperTest { private static final double TOLERANCE = 0.00001; private static final String PROJECT_ID_PREFIX = "test-project-"; private static final String NAMESPACE = "namespace"; private Path dataDir; - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { dataDir = Files.createTempDirectory("gcd"); } - @After - public void tearDown() throws IOException { + @AfterEach + void tearDown() throws IOException { LocalDatastoreHelper.deleteRecursively(dataDir); } @Test - public void testCreate() { + void testCreate() { LocalDatastoreHelper helper = LocalDatastoreHelper.create(0.75); assertTrue(Math.abs(0.75 - helper.getConsistency()) < TOLERANCE); assertTrue(helper.getProjectId().startsWith(PROJECT_ID_PREFIX)); @@ -74,7 +71,7 @@ public void testCreate() { } @Test - public void testCreateWithBuilder() { + void testCreateWithBuilder() { LocalDatastoreHelper helper = LocalDatastoreHelper.newBuilder() .setConsistency(0.75) @@ -95,7 +92,7 @@ public void testCreateWithBuilder() { } @Test - public void testCreateWithCustomProjectId() { + void testCreateWithCustomProjectId() { String customProjectId = "custom-project-id"; LocalDatastoreHelper helper = LocalDatastoreHelper.newBuilder().setProjectId(customProjectId).build(); @@ -103,7 +100,7 @@ public void testCreateWithCustomProjectId() { } @Test - public void testCreateWithToBuilder() throws IOException { + void testCreateWithToBuilder() throws IOException { LocalDatastoreHelper helper = LocalDatastoreHelper.newBuilder() .setConsistency(0.75) @@ -138,7 +135,7 @@ public void testCreateWithToBuilder() throws IOException { } @Test - public void testCreatePort() { + void testCreatePort() { LocalDatastoreHelper helper = LocalDatastoreHelper.create(0.75, 8888); DatastoreOptions options = helper.setNamespace(NAMESPACE).build(); assertTrue(options.getHost().endsWith("8888")); @@ -155,7 +152,7 @@ public void testCreatePort() { } @Test - public void testSetDatabaseId() { + void testSetDatabaseId() { LocalDatastoreHelper helper = LocalDatastoreHelper.create(0.75, 8888); DatastoreOptions options = helper.setNamespace(NAMESPACE).setDatabaseId("new-database-id").build(); @@ -163,7 +160,7 @@ public void testSetDatabaseId() { } @Test - public void testOptions() { + void testOptions() { LocalDatastoreHelper helper = LocalDatastoreHelper.create(); DatastoreOptions options = helper.getOptions(); assertTrue(options.getProjectId().startsWith(PROJECT_ID_PREFIX)); @@ -177,14 +174,14 @@ public void testOptions() { } @Test - public void testDefaultHttpTransportOptions() { + void testDefaultHttpTransportOptions() { LocalDatastoreHelper helper = LocalDatastoreHelper.create(); DatastoreOptions options = helper.getOptions(); assertThat(options.getTransportOptions()).isInstanceOf(HttpTransportOptions.class); } @Test - public void testSetGrpcTransportOptions() { + void testSetGrpcTransportOptions() { LocalDatastoreHelper helper = LocalDatastoreHelper.create(); DatastoreOptions options = helper.getGrpcTransportOptions(GrpcTransportOptions.newBuilder().build()); @@ -194,46 +191,37 @@ public void testSetGrpcTransportOptions() { } @Test - public void testStartStopReset() throws IOException, InterruptedException, TimeoutException { - try { - LocalDatastoreHelper helper = LocalDatastoreHelper.create(); - helper.start(); - Datastore datastore = helper.getOptions().getService(); - Key key = datastore.newKeyFactory().setKind("kind").newKey("name"); - datastore.put(Entity.newBuilder(key).build()); - assertNotNull(datastore.get(key)); - helper.reset(); - assertNull(datastore.get(key)); - helper.stopDuration(Duration.ofMinutes(1)); - datastore.get(key); - Assert.fail(); - } catch (DatastoreException ex) { - assertNotNull(ex.getMessage()); - } + void testStartStopReset() throws IOException, InterruptedException, TimeoutException { + LocalDatastoreHelper helper = LocalDatastoreHelper.create(); + helper.start(); + Datastore datastore = helper.getOptions().getService(); + Key key = datastore.newKeyFactory().setKind("kind").newKey("name"); + datastore.put(Entity.newBuilder(key).build()); + assertNotNull(datastore.get(key)); + helper.reset(); + assertNull(datastore.get(key)); + helper.stopDuration(Duration.ofMinutes(1)); + DatastoreException ex = assertThrows(DatastoreException.class, () -> datastore.get(key)); + assertNotNull(ex.getMessage()); } @Test - public void testStartStopResetWithBuilder() - throws IOException, InterruptedException, TimeoutException { - try { - LocalDatastoreHelper helper = LocalDatastoreHelper.newBuilder().build(); - helper.start(); - Datastore datastore = helper.getOptions().getService(); - Key key = datastore.newKeyFactory().setKind("kind").newKey("name"); - datastore.put(Entity.newBuilder(key).build()); - assertNotNull(datastore.get(key)); - helper.reset(); - assertNull(datastore.get(key)); - helper.stopDuration(Duration.ofMinutes(1)); - datastore.get(key); - Assert.fail(); - } catch (DatastoreException ex) { - assertNotNull(ex.getMessage()); - } + void testStartStopResetWithBuilder() throws IOException, InterruptedException, TimeoutException { + LocalDatastoreHelper helper = LocalDatastoreHelper.newBuilder().build(); + helper.start(); + Datastore datastore = helper.getOptions().getService(); + Key key = datastore.newKeyFactory().setKind("kind").newKey("name"); + datastore.put(Entity.newBuilder(key).build()); + assertNotNull(datastore.get(key)); + helper.reset(); + assertNull(datastore.get(key)); + helper.stopDuration(Duration.ofMinutes(1)); + DatastoreException ex = assertThrows(DatastoreException.class, () -> datastore.get(key)); + assertNotNull(ex.getMessage()); } @Test - public void testCreateWithFirestoreInDatastoreMode() + void testCreateWithFirestoreInDatastoreMode() throws IOException, InterruptedException, TimeoutException { LocalDatastoreHelper helper = LocalDatastoreHelper.newBuilder().setFirestoreInDatastoreMode(true).build(); diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java index 293c904b9..97cead185 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientHttpJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java index 909330b51..d70d27776 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/DatastoreClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java index e64c68018..35c889815 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastore.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java index e37eac6c0..e65bd2168 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/v1/MockDatastoreImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/grpc-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminGrpc.java b/grpc-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminGrpc.java index 865f9b090..8f2552416 100644 --- a/grpc-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminGrpc.java +++ b/grpc-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminGrpc.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java b/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java index 860482c55..7fda0f920 100644 --- a/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java +++ b/grpc-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreGrpc.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/pom.xml b/pom.xml index 462070dc8..9c4a02109 100644 --- a/pom.xml +++ b/pom.xml @@ -147,6 +147,7 @@ 2.42.0 + 5.10.3 @@ -158,6 +159,13 @@ pom import + + org.junit + junit-bom + ${junit.version} + pom + import + com.google.api.grpc @@ -200,13 +208,6 @@ - - - junit - junit - 4.13.2 - test - org.easymock easymock @@ -219,6 +220,14 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + plain + false + + org.apache.maven.plugins maven-dependency-plugin @@ -227,6 +236,10 @@ com.google.http-client:google-http-client-jackson2 com.google.oauth-client:google-oauth-client javax.annotation:javax.annotation-api + + org.junit.jupiter:junit-jupiter-engine + + org.junit.vintage:junit-vintage-engine diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadata.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadata.java index d73ecd26c..0d6df9801 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadata.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadataOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadataOrBuilder.java index c27c9174d..59a484b0c 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadataOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CommonMetadataOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequest.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequest.java index 87af20988..07885be65 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequest.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequestOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequestOrBuilder.java index c60c9be07..0dc20129c 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequestOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/CreateIndexRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminProto.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminProto.java index 6bf22f9d3..f9a63cb86 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminProto.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreAdminProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadata.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadata.java index c87056546..7f6e0c893 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadata.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadataOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadataOrBuilder.java index 93572d535..000588d7d 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadataOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DatastoreFirestoreMigrationMetadataOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequest.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequest.java index 708a59ff9..34c33485c 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequest.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequestOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequestOrBuilder.java index 9639e7570..a1a166d85 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequestOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/DeleteIndexRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilter.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilter.java index 623478375..d9ae8b386 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilter.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilterOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilterOrBuilder.java index 502b42d35..75e35d5bb 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilterOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/EntityFilterOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadata.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadata.java index 6963c8fd1..abf0cbe50 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadata.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadataOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadataOrBuilder.java index 409b713ae..086062f90 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadataOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesMetadataOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequest.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequest.java index 5186fbb1a..f5ea6a2f3 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequest.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequestOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequestOrBuilder.java index 73549d372..3ffa58cc1 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequestOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponse.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponse.java index bff44706c..a042fe1d4 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponse.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponseOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponseOrBuilder.java index ed131756b..1566b7337 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponseOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ExportEntitiesResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequest.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequest.java index 7ce114e14..26f1baeee 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequest.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequestOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequestOrBuilder.java index 040281319..ff233bdd6 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequestOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/GetIndexRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadata.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadata.java index 97e2c91e0..d7b1d6fe4 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadata.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadataOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadataOrBuilder.java index bae1dcadd..82598a6e8 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadataOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesMetadataOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequest.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequest.java index b7c648983..fe762d870 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequest.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequestOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequestOrBuilder.java index c4707c6fa..e6468c5f3 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequestOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ImportEntitiesRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Index.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Index.java index 5f21b5938..58f4885b3 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Index.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Index.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadata.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadata.java index 90e653e5a..5760532b9 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadata.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadataOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadataOrBuilder.java index ba20a55a5..c82cb2ef0 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadataOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOperationMetadataOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOrBuilder.java index 74411b8b4..fb22e407c 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexProto.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexProto.java index fe4ac6f69..505a01a0e 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexProto.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/IndexProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequest.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequest.java index 2c444f6b5..0fe980b5e 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequest.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequestOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequestOrBuilder.java index bf5439d9f..b771745fd 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequestOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponse.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponse.java index 8b08cbfcc..2599f3792 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponse.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponseOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponseOrBuilder.java index f44ec108b..75cc023ad 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponseOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ListIndexesResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEvent.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEvent.java index dcc9cf35a..e0a527e0f 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEvent.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEventOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEventOrBuilder.java index 1ef40bfb5..b9bef59e8 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEventOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProgressEventOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProto.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProto.java index 450cebdc4..468872235 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProto.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationState.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationState.java index 09102a467..e71031980 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationState.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationState.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEvent.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEvent.java index c01f43fcb..3a2992566 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEvent.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEventOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEventOrBuilder.java index 45e1efc8b..149b7b43c 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEventOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStateEventOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStep.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStep.java index 8fc3a2614..9f9e47d9d 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStep.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/MigrationStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/OperationType.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/OperationType.java index 149901038..14a178bdb 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/OperationType.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/OperationType.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Progress.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Progress.java index 04912dba4..226d3fdd3 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Progress.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/Progress.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ProgressOrBuilder.java b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ProgressOrBuilder.java index 0383444f1..9952e72f6 100644 --- a/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ProgressOrBuilder.java +++ b/proto-google-cloud-datastore-admin-v1/src/main/java/com/google/datastore/admin/v1/ProgressOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java index 6e382ea85..1abd2b308 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQueryOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQueryOrBuilder.java index 99f400d2c..6d09610d2 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQueryOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationQueryOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResult.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResult.java index 5d2c3f62b..5050ba9df 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResult.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatch.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatch.java index b40e38195..dcdff0999 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatch.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatch.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatchOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatchOrBuilder.java index 1995aae15..7eeb07a7a 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatchOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultBatchOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultOrBuilder.java index 609de95b1..8e11000cc 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultProto.java index 0274db53c..0b48050e9 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultProto.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AggregationResultProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequest.java index 5fad3328c..3bceb8c32 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequestOrBuilder.java index bd87ecd13..1665521ad 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponse.java index 730bda037..792bd26f6 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponseOrBuilder.java index e442c3c27..0a15ec9ca 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/AllocateIdsResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValue.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValue.java index 67de9d652..bc9cae3cf 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValue.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValueOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValueOrBuilder.java index 0e631b6e2..5c64d8281 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValueOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ArrayValueOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequest.java index 90c32dc34..dffdd9d44 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequestOrBuilder.java index 1ffdcf176..e1513d8cd 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponse.java index 4c73112a7..c69be99ce 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponseOrBuilder.java index 3f0ad182a..74b0190f9 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/BeginTransactionResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequest.java index d3af7bbbd..dc2995770 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequestOrBuilder.java index 64333f04f..ec719960e 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponse.java index 690d9243e..ccc312140 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponseOrBuilder.java index 24205c882..062e2a36e 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CommitResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilter.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilter.java index 010b4ff2c..40a7539c4 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilter.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilterOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilterOrBuilder.java index 7ef29d5f9..4394f2ef7 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilterOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/CompositeFilterOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreProto.java index 97b3ba628..bca4d7155 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreProto.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Entity.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Entity.java index 67d9354bb..b539dc621 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Entity.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Entity.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityOrBuilder.java index 61ea8e8ee..b6d546e2f 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityProto.java index 17c1c1a30..adcd56c78 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityProto.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResult.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResult.java index 100c9fad4..22432f8ff 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResult.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResultOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResultOrBuilder.java index 6a02b4c08..de6af24cb 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResultOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/EntityResultOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStats.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStats.java index f6f0ae83d..1cd6d50b1 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStats.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStats.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStatsOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStatsOrBuilder.java index 6289a7e9f..4c4d256b3 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStatsOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExecutionStatsOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetrics.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetrics.java index abea37234..41ece50d4 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetrics.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetrics.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetricsOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetricsOrBuilder.java index cc1c6625f..c49c3827c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetricsOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainMetricsOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptions.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptions.java index 720f3e85b..17239c1c7 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptions.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptionsOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptionsOrBuilder.java index 67d6a5156..6f32190d5 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptionsOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ExplainOptionsOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Filter.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Filter.java index 8211ea1f2..c0a7db151 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Filter.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FilterOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FilterOrBuilder.java index 9ef339fa9..acd6a9ef1 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FilterOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FilterOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java index 08adba246..99b606853 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java index 631975f60..f4c8408ba 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/FindNearestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQuery.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQuery.java index 831a282f5..4da9e332f 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQuery.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryOrBuilder.java index a2d5bf0b3..8ab95e172 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameter.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameter.java index 5349f046a..69a6fab1f 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameter.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameterOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameterOrBuilder.java index bd2cbfc51..896cd02f4 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameterOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/GqlQueryParameterOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Key.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Key.java index 45c5cd73c..152ae4079 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Key.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Key.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KeyOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KeyOrBuilder.java index 612744003..c22132f79 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KeyOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KeyOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpression.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpression.java index d3cc4b102..c0e5c0a08 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpression.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpressionOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpressionOrBuilder.java index 0545ef4f8..665248cbc 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpressionOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/KindExpressionOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequest.java index b791a5c0f..4f7a85bba 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequestOrBuilder.java index a39628e44..5ade8e4aa 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponse.java index 2e80515e0..e3e2dbf56 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponseOrBuilder.java index 892905cf7..929916c68 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Mutation.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Mutation.java index b65d0ca8b..0242260b9 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Mutation.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Mutation.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationOrBuilder.java index 8b433c5ad..8e5c1a1c7 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResult.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResult.java index 71922947d..f3c63d99c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResult.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResultOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResultOrBuilder.java index 4f01efbb6..eee55b02d 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResultOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationResultOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionId.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionId.java index bd8bb8696..f321eade7 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionId.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionId.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionIdOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionIdOrBuilder.java index c35dfd03f..1dbb6bc7d 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionIdOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PartitionIdOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummary.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummary.java index 40b1b9444..b3399cbd1 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummary.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummary.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummaryOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummaryOrBuilder.java index 7299584a1..2692e5f4c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummaryOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PlanSummaryOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Projection.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Projection.java index 796d5225b..dca4ae0ff 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Projection.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Projection.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ProjectionOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ProjectionOrBuilder.java index 4799bba1a..c3a7ccdd6 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ProjectionOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ProjectionOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java index 8fea5e216..18ec7756c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilterOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilterOrBuilder.java index 02a9da727..ecfb5f3e0 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilterOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyFilterOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMask.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMask.java index 9f6e0e540..a5ae3b9e1 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMask.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMask.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMaskOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMaskOrBuilder.java index d4038d59f..3c237c5e6 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMaskOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMaskOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrder.java index 381e21973..141dacb7c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrderOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrderOrBuilder.java index 01b8e22f3..ba2235830 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrderOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyOrderOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReference.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReference.java index 184e3aa59..8f95f901c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReference.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReferenceOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReferenceOrBuilder.java index 503a1dd24..9dc18e7dc 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReferenceOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyReferenceOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransform.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransform.java index 243f31739..32df3f0ae 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransform.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransform.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransformOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransformOrBuilder.java index c9a74555a..ae005e6ad 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransformOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyTransformOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java index 990f78cb9..f85c1d84f 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Query.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java index d581848b2..226e261ed 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProfileProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProfileProto.java index 4a6980072..2fa5ac143 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProfileProto.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProfileProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java index 875844726..67392d6cb 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatch.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatch.java index f3634d09d..b188c5c04 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatch.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatch.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatchOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatchOrBuilder.java index d4d2db887..c6981a114 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatchOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/QueryResultBatchOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptions.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptions.java index 578c3c132..78a93952b 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptions.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java index 97460f1de..f2de0cd09 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReadOptionsOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequest.java index 4326bd298..f4962f595 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequestOrBuilder.java index d53ae5cbb..3568efbd8 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponse.java index 962388f7a..9a915ffe9 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponseOrBuilder.java index 7002f2b45..ff223f82c 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ReserveIdsResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequest.java index e48e88443..a7ec66800 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequestOrBuilder.java index 6c4f2234a..343feed3f 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponse.java index afdb9f900..6bcf2e82e 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponseOrBuilder.java index b8c871f53..9809ceb07 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RollbackResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequest.java index bdae4252d..dbabd22b8 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequestOrBuilder.java index 6cf4dc5b1..9994dc734 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponse.java index d23698c1e..f0bfa2cc4 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponseOrBuilder.java index 0c10bc354..877b9f58d 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunAggregationQueryResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequest.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequest.java index 9ef7a6e0f..df93c2817 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequest.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequestOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequestOrBuilder.java index 3a7bd8996..e76e33170 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequestOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequestOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponse.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponse.java index f8c571c1b..967b0ab56 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponse.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponseOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponseOrBuilder.java index 0d389b65e..6cbe1650a 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponseOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryResponseOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java index 82d8db4c6..7b14b00e0 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptionsOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptionsOrBuilder.java index c75d40723..61a7fe682 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptionsOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/TransactionOptionsOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Value.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Value.java index 20ddd8bb5..4e7a02a24 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Value.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Value.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ValueOrBuilder.java b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ValueOrBuilder.java index 53035cd7c..87693966d 100644 --- a/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ValueOrBuilder.java +++ b/proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/ValueOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java b/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java index 40b22c89d..d647fb9df 100644 --- a/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java @@ -25,12 +25,12 @@ /** Tests for ConfigureConnectionPool sample. */ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -public class ConfigureConnectionPoolIT { +class ConfigureConnectionPoolIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Test - public void testConfigureConnectionPool() throws Exception { + void testConfigureConnectionPool() throws Exception { ConfigureConnectionPool.main(); systemsOutRule.assertContains( "Connected with pool with InitialChannelCount: 10, MinChannelCount: 5, MaxChannelCount:" diff --git a/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java b/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java index 09823479f..ff8365023 100644 --- a/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java @@ -30,7 +30,7 @@ /** Tests for quickstart sample. */ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -public class QuickstartSampleIT { +class QuickstartSampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @@ -43,18 +43,18 @@ private static final void deleteTestEntity() { } @Before - public void setUp() { + void setUp() { deleteTestEntity(); } @After - public void tearDown() { + void tearDown() { System.setOut(null); deleteTestEntity(); } @Test - public void testQuickstart() throws Exception { + void testQuickstart() throws Exception { QuickstartSample.main(); systemsOutRule.assertContains("Saved sampletask1: Buy milk"); systemsOutRule.assertContains("Retrieved sampletask1: Buy milk"); diff --git a/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java b/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java index 65a5ef3f3..c8950a88f 100644 --- a/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java @@ -30,14 +30,14 @@ import org.junit.Rule; import org.junit.Test; -public class AggregationQuerySampleTestIT { +class AggregationQuerySampleTestIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - public void setUp() throws Exception { + void setUp() throws Exception { // Retrieving and deleting all the 'Task' entities. KeyQuery allKeysQuery = Query.newKeyQueryBuilder().setKind("Task").build(); QueryResults allKeys = datastore.run(allKeysQuery); @@ -46,33 +46,33 @@ public void setUp() throws Exception { } @Test - public void testAggregationQueryAndCountAggregationSample() { + void testAggregationQueryAndCountAggregationSample() { CountAggregationOnKind.invoke(); systemsOutRule.assertContains("Total tasks count is 3"); systemsOutRule.assertContains("Total tasks (accessible from default alias) is 3"); } @Test - public void testAggregationQueryAndCountAggregationWithLimitSample() { + void testAggregationQueryAndCountAggregationWithLimitSample() { CountAggregationWithLimit.invoke(); systemsOutRule.assertContains("We have at least 2 tasks"); } @Test - public void testAggregationQueryAndCountAggregationWithOrderBySample() { + void testAggregationQueryAndCountAggregationWithOrderBySample() { CountAggregationWithOrderBy.invoke(); systemsOutRule.assertContains("Total 2 tasks found with priority field"); } @Test - public void testAggregationQueryAndCountAggregationWithPropertyFilterSample() { + void testAggregationQueryAndCountAggregationWithPropertyFilterSample() { CountAggregationWithPropertyFilter.invoke(); systemsOutRule.assertContains("Total completed tasks count is 2"); systemsOutRule.assertContains("Total remaining tasks count is 1"); } @Test - public void testAggregationQueryAndCountAggregationSampleWithGqlQuery() { + void testAggregationQueryAndCountAggregationSampleWithGqlQuery() { CountAggregationWithGqlQuery.invoke(); systemsOutRule.assertContains("We have at least 2 tasks"); systemsOutRule.assertContains("Total tasks count is 3"); @@ -80,68 +80,68 @@ public void testAggregationQueryAndCountAggregationSampleWithGqlQuery() { } @Test - public void testAggregationQueryAndCountWithStaleRead() throws InterruptedException { + void testAggregationQueryAndCountWithStaleRead() throws InterruptedException { CountAggregationWithStaleRead.invoke(); systemsOutRule.assertContains("Latest tasks count is 3"); systemsOutRule.assertContains("Stale tasks count is 2"); } @Test - public void testAggregationQueryAndCountWithTransaction() throws InterruptedException { + void testAggregationQueryAndCountWithTransaction() throws InterruptedException { assertThrows(Exception.class, CountAggregationInTransaction::invoke); systemsOutRule.assertContains("Found existing 2 tasks, rolling back"); } @Test - public void testSumAggregationWithKind() { + void testSumAggregationWithKind() { SumAggregationOnKind.invoke(); systemsOutRule.assertContains("Total sales is 239"); } @Test - public void testAvgAggregationWithKind() { + void testAvgAggregationWithKind() { AvgAggregationOnKind.invoke(); systemsOutRule.assertContains("Average sales is 79.66666667"); } @Test - public void testSumAggregationWithPropertyFilter() { + void testSumAggregationWithPropertyFilter() { SumAggregationWithPropertyFilter.invoke(); systemsOutRule.assertContains("Customer 1 sales sum is 184"); } @Test - public void testAvgAggregationWithPropertyFilter() { + void testAvgAggregationWithPropertyFilter() { AvgAggregationWithPropertyFilter.invoke(); systemsOutRule.assertContains("Customer 1 sales avg is 92"); } @Test - public void testSumAggregationWithLimit() { + void testSumAggregationWithLimit() { SumAggregationWithLimit.invoke(); systemsOutRule.assertContains("We have a minimum sales sum of 144."); } @Test - public void testAvgAggregationWithLimit() { + void testAvgAggregationWithLimit() { AvgAggregationWithLimit.invoke(); systemsOutRule.assertContains("Average with limit 2 is 72."); } @Test - public void testSumAggregationWithOrderBy() { + void testSumAggregationWithOrderBy() { SumAggregationWithOrderBy.invoke(); systemsOutRule.assertContains("Total sum of 144 with valid customerId field"); } @Test - public void testAvgAggregationWithOrderBy() { + void testAvgAggregationWithOrderBy() { AvgAggregationWithOrderBy.invoke(); systemsOutRule.assertContains("Total avg of 72 with valid customerId field"); } @Test - public void testMultipleAggregationsInStructuredQuery() { + void testMultipleAggregationsInStructuredQuery() { MultipleAggregationsInStructuredQuery.invoke(); systemsOutRule.assertContains("Total sales count: 3"); systemsOutRule.assertContains("Sum of sales: 239"); @@ -149,7 +149,7 @@ public void testMultipleAggregationsInStructuredQuery() { } @Test - public void testMultipleAggregationsInGQLQuery() { + void testMultipleAggregationsInGQLQuery() { MultipleAggregationsInGqlQuery.invoke(); systemsOutRule.assertContains("Total sales count: 3"); systemsOutRule.assertContains("Sum of sales: 239"); diff --git a/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java b/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java index 8e3fa4c10..2cc30179c 100644 --- a/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java @@ -30,7 +30,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -public class MultiIneqQuerySampleIT { +class MultiIneqQuerySampleIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); @@ -41,7 +41,7 @@ public class MultiIneqQuerySampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - public void setUp() { + void setUp() { employeeKey1 = datastore.newKeyFactory().setKind("employees").newKey("employee1"); Entity employee1 = Entity.newBuilder(employeeKey1) @@ -72,14 +72,14 @@ public void setUp() { } @After - public void tearDown() { + void tearDown() { datastore.delete(employeeKey1); datastore.delete(employeeKey2); datastore.delete(employeeKey3); } @Test - public void testIndexingConsiderationQuery() throws Exception { + void testIndexingConsiderationQuery() throws Exception { // Act IndexingConsiderationQuery.invoke(); @@ -88,7 +88,7 @@ public void testIndexingConsiderationQuery() throws Exception { } @Test - public void testOrderFieldsQuery() throws Exception { + void testOrderFieldsQuery() throws Exception { // Act OrderFieldsQuery.invoke(); diff --git a/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java b/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java index a1b84cdfd..2637bcf0e 100644 --- a/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java @@ -30,7 +30,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -public class OrFilterQuerySampleIT { +class OrFilterQuerySampleIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); private final String fieldName = "description"; @@ -41,7 +41,7 @@ public class OrFilterQuerySampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - public void setUp() { + void setUp() { taskKey1 = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); Entity task1 = Entity.newBuilder(taskKey1).set(fieldName, "Buy milk").build(); @@ -53,13 +53,13 @@ public void setUp() { } @After - public void tearDown() { + void tearDown() { datastore.delete(taskKey1); datastore.delete(taskKey2); } @Test - public void testOrFilterQuery() throws Exception { + void testOrFilterQuery() throws Exception { // Act OrFilterQuery.invoke(); diff --git a/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java b/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java index 6003b4a0f..7366c91bb 100644 --- a/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java @@ -30,7 +30,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -public class QueryProfileSampleIT { +class QueryProfileSampleIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); private final String fieldName = "description"; @@ -41,7 +41,7 @@ public class QueryProfileSampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - public void setUp() { + void setUp() { taskKey1 = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); Entity task1 = Entity.newBuilder(taskKey1).set(fieldName, "Buy milk").build(); @@ -53,13 +53,13 @@ public void setUp() { } @After - public void tearDown() { + void tearDown() { datastore.delete(taskKey1); datastore.delete(taskKey2); } @Test - public void testQueryProfileExplain() throws Exception { + void testQueryProfileExplain() throws Exception { // Act QueryProfileExplain.invoke(); @@ -69,7 +69,7 @@ public void testQueryProfileExplain() throws Exception { } @Test - public void testQueryProfileExplainAggregation() throws Exception { + void testQueryProfileExplainAggregation() throws Exception { // Act QueryProfileExplainAggregation.invoke(); @@ -79,7 +79,7 @@ public void testQueryProfileExplainAggregation() throws Exception { } @Test - public void testQueryProfileExplainAnalyze() throws Exception { + void testQueryProfileExplainAnalyze() throws Exception { // Act QueryProfileExplainAnalyze.invoke(); @@ -91,7 +91,7 @@ public void testQueryProfileExplainAnalyze() throws Exception { } @Test - public void testQueryProfileExplainAnalyzeAggregation() throws Exception { + void testQueryProfileExplainAnalyzeAggregation() throws Exception { // Act QueryProfileExplainAnalyzeAggregation.invoke(); diff --git a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java index 13701eb2d..9f10ed454 100644 --- a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java +++ b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java @@ -80,7 +80,7 @@ /** Contains Cloud Datastore snippets demonstrating concepts for documentation. */ @RunWith(JUnit4.class) -public class ConceptsTest { +class ConceptsTest { private static final LocalDatastoreHelper HELPER = LocalDatastoreHelper.create(1.0); private static final FullEntity TEST_FULL_ENTITY = FullEntity.newBuilder().build(); @@ -103,7 +103,7 @@ public class ConceptsTest { * @throws InterruptedException if there are errors starting the local Datastore */ @BeforeClass - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { HELPER.start(); } @@ -112,7 +112,7 @@ public static void beforeClass() throws IOException, InterruptedException { * used for testing. */ @Before - public void setUp() { + void setUp() { datastore = HELPER.getOptions().toBuilder().setNamespace("ghijklmnop").build().getService(); StructuredQuery query = Query.newKeyQueryBuilder().build(); QueryResults result = datastore.run(query); @@ -132,7 +132,7 @@ public void setUp() { } @After - public void tearDown() throws Exception { + void tearDown() throws Exception { KeyQuery taskQuery = Query.newKeyQueryBuilder().setKind("Task").build(); Key[] taskKeysToDelete = Iterators.toArray(datastoreRealBackend.run(taskQuery), Key.class); datastoreRealBackend.delete(taskKeysToDelete); @@ -145,7 +145,7 @@ public void tearDown() throws Exception { * @throws InterruptedException if there are errors stopping the local Datastore */ @AfterClass - public static void afterClass() throws IOException, InterruptedException, TimeoutException { + static void afterClass() throws IOException, InterruptedException, TimeoutException { HELPER.stopDuration(java.time.Duration.ofMinutes(1)); } @@ -154,7 +154,7 @@ private void assertValidKey(Key taskKey) { } @Test - public void testIncompleteKey() { + void testIncompleteKey() { // [START datastore_incomplete_key] KeyFactory keyFactory = datastore.newKeyFactory().setKind("Task"); Key taskKey = datastore.allocateId(keyFactory.newKey()); @@ -163,7 +163,7 @@ public void testIncompleteKey() { } @Test - public void testNamedKey() { + void testNamedKey() { // [START datastore_named_key] Key taskKey = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); // [END datastore_named_key] @@ -171,7 +171,7 @@ public void testNamedKey() { } @Test - public void testKeyWithParent() { + void testKeyWithParent() { // [START datastore_key_with_parent] Key taskKey = datastore @@ -184,7 +184,7 @@ public void testKeyWithParent() { } @Test - public void testKeyWithMultilevelParent() { + void testKeyWithMultilevelParent() { // [START datastore_key_with_multilevel_parent] KeyFactory keyFactory = datastore @@ -202,7 +202,7 @@ private void assertValidEntity(Entity original) { } @Test - public void testEntityWithParent() { + void testEntityWithParent() { // [START datastore_entity_with_parent] Key taskKey = datastore @@ -222,7 +222,7 @@ public void testEntityWithParent() { } @Test - public void testProperties() { + void testProperties() { // [START datastore_properties] Entity task = Entity.newBuilder(taskKey) @@ -240,7 +240,7 @@ public void testProperties() { } @Test - public void testArrayValue() { + void testArrayValue() { // [START datastore_array_value] Entity task = Entity.newBuilder(taskKey) @@ -252,7 +252,7 @@ public void testArrayValue() { } @Test - public void testBasicEntity() { + void testBasicEntity() { // [START datastore_basic_entity] Key taskKey = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); Entity task = @@ -267,7 +267,7 @@ public void testBasicEntity() { } @Test - public void testUpsert() { + void testUpsert() { // [START datastore_upsert] Entity task = Entity.newBuilder(keyFactory.newKey("sampleTask")).build(); datastore.put(task); @@ -276,7 +276,7 @@ public void testUpsert() { } @Test - public void testInsert() { + void testInsert() { // [START datastore_insert] Key taskKey = datastore.add(FullEntity.newBuilder(keyFactory.newKey()).build()).getKey(); // [END datastore_insert] @@ -284,7 +284,7 @@ public void testInsert() { } @Test - public void testLookup() { + void testLookup() { datastore.put(testEntity); // [START datastore_lookup] Entity task = datastore.get(taskKey); @@ -293,7 +293,7 @@ public void testLookup() { } @Test - public void testUpdate() { + void testUpdate() { datastore.put(testEntity); // [START datastore_update] Entity task; @@ -312,7 +312,7 @@ public void testUpdate() { } @Test - public void testDelete() { + void testDelete() { datastore.put(testEntity); // [START datastore_delete] datastore.delete(taskKey); @@ -340,7 +340,7 @@ private List setUpBatchTests(Key taskKey1, Key taskKey2) { } @Test - public void testBatchUpsert() { + void testBatchUpsert() { // [START datastore_batch_upsert] FullEntity task1 = FullEntity.newBuilder(keyFactory.newKey()) @@ -365,7 +365,7 @@ public void testBatchUpsert() { } @Test - public void testBatchLookup() { + void testBatchLookup() { Key taskKey1 = keyFactory.newKey(1); Key taskKey2 = keyFactory.newKey(2); List expectedTasks = setUpBatchTests(taskKey1, taskKey2); @@ -377,7 +377,7 @@ public void testBatchLookup() { } @Test - public void testBatchDelete() { + void testBatchDelete() { Key taskKey1 = keyFactory.newKey(1); Key taskKey2 = keyFactory.newKey(2); setUpBatchTests(taskKey1, taskKey2); @@ -423,7 +423,7 @@ private void assertInvalidQuery(Query query) { } @Test - public void testBasicQuery() { + void testBasicQuery() { setUpQueryTests(); // [START datastore_basic_query] Query query = @@ -439,7 +439,7 @@ public void testBasicQuery() { } @Test - public void testRunQuery() { + void testRunQuery() { setUpQueryTests(); Query query = Query.newEntityQueryBuilder().setKind("Task").build(); // [START datastore_run_query] @@ -450,7 +450,7 @@ public void testRunQuery() { } @Test - public void testPropertyFilter() { + void testPropertyFilter() { setUpQueryTests(); // [START datastore_property_filter] Query query = @@ -463,7 +463,7 @@ public void testPropertyFilter() { } @Test - public void testCompositeFilter() { + void testCompositeFilter() { setUpQueryTests(); // [START datastore_composite_filter] Query query = @@ -478,7 +478,7 @@ public void testCompositeFilter() { } @Test - public void testKeyFilter() { + void testKeyFilter() { setUpQueryTests(); // [START datastore_key_filter] Query query = @@ -491,7 +491,7 @@ public void testKeyFilter() { } @Test - public void testAscendingSort() { + void testAscendingSort() { setUpQueryTests(); // [START datastore_ascending_sort] Query query = @@ -501,7 +501,7 @@ public void testAscendingSort() { } @Test - public void testDescendingSort() { + void testDescendingSort() { setUpQueryTests(); // [START datastore_descending_sort] Query query = @@ -511,7 +511,7 @@ public void testDescendingSort() { } @Test - public void testMultiSort() { + void testMultiSort() { setUpQueryTests(); // [START datastore_multi_sort] Query query = @@ -524,7 +524,7 @@ public void testMultiSort() { } @Test - public void testKindlessQuery() { + void testKindlessQuery() { Key lastSeenKey = keyFactory.newKey("a"); setUpQueryTests(); // [START datastore_kindless_query] @@ -535,7 +535,7 @@ public void testKindlessQuery() { } @Test - public void testAncestorQuery() { + void testAncestorQuery() { setUpQueryTests(); // [START datastore_ancestor_query] Query query = @@ -550,7 +550,7 @@ public void testAncestorQuery() { } @Test - public void testProjectionQuery() { + void testProjectionQuery() { setUpQueryTests(); // [START datastore_projection_query] Query query = @@ -563,7 +563,7 @@ public void testProjectionQuery() { } @Test - public void testRunProjectionQuery() { + void testRunProjectionQuery() { setUpQueryTests(); Query query = Query.newProjectionEntityQueryBuilder() @@ -585,7 +585,7 @@ public void testRunProjectionQuery() { } @Test - public void testKeysOnlyQuery() { + void testKeysOnlyQuery() { setUpQueryTests(); // [START datastore_keys_only_query] Query query = Query.newKeyQueryBuilder().setKind("Task").build(); @@ -594,7 +594,7 @@ public void testKeysOnlyQuery() { } @Test - public void testDistinctOnQuery() { + void testDistinctOnQuery() { setUpQueryTests(); // [START datastore_distinct_on_query] Query query = @@ -609,7 +609,7 @@ public void testDistinctOnQuery() { } @Test - public void testArrayValueInequalityRange() { + void testArrayValueInequalityRange() { setUpQueryTests(); // [START datastore_array_value_inequality_range] Query query = @@ -625,7 +625,7 @@ public void testArrayValueInequalityRange() { } @Test - public void testArrayValueEquality() { + void testArrayValueEquality() { setUpQueryTests(); // [START datastore_array_value_equality] Query query = @@ -640,7 +640,7 @@ public void testArrayValueEquality() { } @Test - public void testInequalityRange() { + void testInequalityRange() { setUpQueryTests(); // [START datastore_inequality_range] Query query = @@ -655,7 +655,7 @@ public void testInequalityRange() { } @Test - public void testInequalityInvalid() { + void testInequalityInvalid() { // [START datastore_inequality_invalid] Query query = Query.newEntityQueryBuilder() @@ -669,7 +669,7 @@ public void testInequalityInvalid() { } @Test - public void testEqualAndInequalityRange() { + void testEqualAndInequalityRange() { setUpQueryTests(); // [START datastore_equal_and_inequality_range] Query query = @@ -686,7 +686,7 @@ public void testEqualAndInequalityRange() { } @Test - public void testInequalitySort() { + void testInequalitySort() { setUpQueryTests(); // [START datastore_inequality_sort] Query query = @@ -700,7 +700,7 @@ public void testInequalitySort() { } @Test - public void testInequalitySortInvalidNotSame() { + void testInequalitySortInvalidNotSame() { // [START datastore_inequality_sort_invalid_not_same] Query query = Query.newEntityQueryBuilder() @@ -713,7 +713,7 @@ public void testInequalitySortInvalidNotSame() { } @Test - public void testInequalitySortInvalidNotFirst() { + void testInequalitySortInvalidNotFirst() { // [START datastore_inequality_sort_invalid_not_first] Query query = Query.newEntityQueryBuilder() @@ -726,7 +726,7 @@ public void testInequalitySortInvalidNotFirst() { } @Test - public void testLimit() { + void testLimit() { setUpQueryTests(); // [START datastore_limit] Query query = Query.newEntityQueryBuilder().setKind("Task").setLimit(5).build(); @@ -735,7 +735,7 @@ public void testLimit() { } @Test - public void testCursorPaging() { + void testCursorPaging() { setUpQueryTests(); datastore.put(testEntity); Cursor nextPageCursor = cursorPaging(1, null); @@ -762,7 +762,7 @@ private Cursor cursorPaging(int pageSize, Cursor pageCursor) { } @Test - public void testEventualConsistentQuery() { + void testEventualConsistentQuery() { setUpQueryTests(); // [START datastore_eventual_consistent_query] Query query = @@ -778,7 +778,7 @@ public void testEventualConsistentQuery() { } @Test - public void testUnindexedPropertyQuery() { + void testUnindexedPropertyQuery() { setUpQueryTests(); // [START datastore_unindexed_property_query] Query query = @@ -792,7 +792,7 @@ public void testUnindexedPropertyQuery() { } @Test - public void testExplodingProperties() { + void testExplodingProperties() { // [START datastore_exploding_properties] Entity task = Entity.newBuilder(taskKey) @@ -819,7 +819,7 @@ private void assertSuccessfulTransfer(Key from, Key to) { } @Test - public void testTransactionalUpdate() { + void testTransactionalUpdate() { List keys = setUpTransferTests(); transferFunds(keys.get(0), keys.get(1), 10); assertSuccessfulTransfer(keys.get(0), keys.get(1)); @@ -848,7 +848,7 @@ void transferFunds(Key fromKey, Key toKey, long amount) { // [END datastore_transactional_update] @Test - public void testTransactionalRetry() { + void testTransactionalRetry() { List keys = setUpTransferTests(); Key fromKey = keys.get(0); Key toKey = keys.get(1); @@ -871,7 +871,7 @@ public void testTransactionalRetry() { } @Test - public void testTransactionalGetOrCreate() { + void testTransactionalGetOrCreate() { // [START datastore_transactional_get_or_create] Entity task; Transaction txn = datastore.newTransaction(); @@ -892,7 +892,7 @@ public void testTransactionalGetOrCreate() { } @Test - public void testTransactionalSingleEntityGroupReadOnly() { + void testTransactionalSingleEntityGroupReadOnly() { setUpQueryTests(); Key taskListKey = datastore.newKeyFactory().setKind("TaskList").newKey("default"); Entity taskListEntity = Entity.newBuilder(taskListKey).build(); @@ -924,7 +924,7 @@ public void testTransactionalSingleEntityGroupReadOnly() { } @Test - public void testNamespaceRunQuery() { + void testNamespaceRunQuery() { setUpQueryTests(); // [START datastore_namespace_run_query] KeyFactory keyFactory = datastore.newKeyFactory().setKind("__namespace__"); @@ -948,7 +948,7 @@ public void testNamespaceRunQuery() { } @Test - public void testKindRunQuery() { + void testKindRunQuery() { setUpQueryTests(); // [START datastore_kind_run_query] Query query = Query.newKeyQueryBuilder().setKind("__kind__").build(); @@ -962,7 +962,7 @@ public void testKindRunQuery() { } @Test - public void testPropertyRunQuery() { + void testPropertyRunQuery() { setUpQueryTests(); // [START datastore_property_run_query] Query query = Query.newKeyQueryBuilder().setKind("__property__").build(); @@ -996,7 +996,7 @@ public void testPropertyRunQuery() { } @Test - public void testPropertyByKindRunQuery() { + void testPropertyByKindRunQuery() { setUpQueryTests(); // [START datastore_property_by_kind_run_query] Key key = datastore.newKeyFactory().setKind("__kind__").newKey("Task"); @@ -1035,7 +1035,7 @@ public void testPropertyByKindRunQuery() { } @Test - public void testPropertyFilteringRunQuery() { + void testPropertyFilteringRunQuery() { setUpQueryTests(); // [START datastore_property_filtering_run_query] Key startKey = @@ -1069,7 +1069,7 @@ public void testPropertyFilteringRunQuery() { } @Test - public void testEqQuerySorted() { + void testEqQuerySorted() { setUpQueryTests(); // [START datastore_eq_query_sorted] Query query = @@ -1113,7 +1113,7 @@ private void setUpQueryTestsRealBackend() { } @Test - public void testInQuery() { + void testInQuery() { setUpQueryTestsRealBackend(); // [START datastore_in_query] Query query = @@ -1126,7 +1126,7 @@ public void testInQuery() { } @Test - public void testNotEqualsQuery() { + void testNotEqualsQuery() { setUpQueryTestsRealBackend(); // [START datastore_not_equals_query] Query query = @@ -1139,7 +1139,7 @@ public void testNotEqualsQuery() { } @Test - public void testNotInQuery() { + void testNotInQuery() { setUpQueryTestsRealBackend(); // [START datastore_not_in_query] Query query = @@ -1152,7 +1152,7 @@ public void testNotInQuery() { } @Test - public void testInQuerySorted() { + void testInQuerySorted() { setUpQueryTestsRealBackend(); // [START datastore_in_query_sorted] Query query = @@ -1166,7 +1166,7 @@ public void testInQuerySorted() { } @Test - public void testStaleReads() throws InterruptedException { + void testStaleReads() throws InterruptedException { setUpQueryTestsRealBackend(); // waiting for 6 seconds, so that we can query with read time of 5 seconds ago TimeUnit.SECONDS.sleep(6); From c4c553f713a6e9248ae775dcaca221911024835b Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 12 Jan 2026 21:06:30 -0500 Subject: [PATCH 2/7] chore: Fix dependencies plugin check --- google-cloud-datastore/pom.xml | 5 ----- pom.xml | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml index cc040759a..08899942a 100644 --- a/google-cloud-datastore/pom.xml +++ b/google-cloud-datastore/pom.xml @@ -192,11 +192,6 @@ junit-jupiter-engine test - - org.junit.jupiter - junit-jupiter-params - test - org.junit.vintage junit-vintage-engine diff --git a/pom.xml b/pom.xml index 9c4a02109..3944b54a4 100644 --- a/pom.xml +++ b/pom.xml @@ -147,7 +147,6 @@ 2.42.0 - 5.10.3 @@ -159,13 +158,6 @@ pom import - - org.junit - junit-bom - ${junit.version} - pom - import - com.google.api.grpc @@ -208,6 +200,16 @@ + + + + + + junit + junit + 4.13.2 + test + org.easymock easymock From 2dc393402fc057634a6868c4cd8a87511674bb06 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 12 Jan 2026 21:21:01 -0500 Subject: [PATCH 3/7] chore: Move junit 4.x dep and reset samples --- datastore-v1-proto-client/pom.xml | 5 - google-cloud-datastore-utils/pom.xml | 5 - google-cloud-datastore/pom.xml | 9 ++ pom.xml | 8 -- .../datastore/ConfigureConnectionPoolIT.java | 4 +- .../example/datastore/QuickstartSampleIT.java | 8 +- .../AggregationQuerySampleTestIT.java | 38 +++--- .../filters/MultiIneqQuerySampleIT.java | 10 +- .../filters/OrFilterQuerySampleIT.java | 8 +- .../queryprofile/QueryProfileSampleIT.java | 14 +- .../datastore/snippets/ConceptsTest.java | 126 +++++++++--------- 11 files changed, 113 insertions(+), 122 deletions(-) diff --git a/datastore-v1-proto-client/pom.xml b/datastore-v1-proto-client/pom.xml index c397dbe44..3ce284c3f 100644 --- a/datastore-v1-proto-client/pom.xml +++ b/datastore-v1-proto-client/pom.xml @@ -100,11 +100,6 @@ junit-jupiter-engine test - - org.junit.vintage - junit-vintage-engine - test - com.google.truth diff --git a/google-cloud-datastore-utils/pom.xml b/google-cloud-datastore-utils/pom.xml index d6be9abaa..575830aab 100644 --- a/google-cloud-datastore-utils/pom.xml +++ b/google-cloud-datastore-utils/pom.xml @@ -78,11 +78,6 @@ junit-jupiter-engine test - - org.junit.vintage - junit-vintage-engine - test - com.google.truth truth diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml index 08899942a..cd14c9010 100644 --- a/google-cloud-datastore/pom.xml +++ b/google-cloud-datastore/pom.xml @@ -182,6 +182,14 @@ testlib test + + + + junit + junit + 4.13.2 + test + org.junit.jupiter junit-jupiter-api @@ -214,6 +222,7 @@ 1.17 test + io.opentelemetry diff --git a/pom.xml b/pom.xml index 3944b54a4..a26e518c2 100644 --- a/pom.xml +++ b/pom.xml @@ -202,14 +202,6 @@ - - - - junit - junit - 4.13.2 - test - org.easymock easymock diff --git a/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java b/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java index d647fb9df..40b22c89d 100644 --- a/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/ConfigureConnectionPoolIT.java @@ -25,12 +25,12 @@ /** Tests for ConfigureConnectionPool sample. */ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -class ConfigureConnectionPoolIT { +public class ConfigureConnectionPoolIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Test - void testConfigureConnectionPool() throws Exception { + public void testConfigureConnectionPool() throws Exception { ConfigureConnectionPool.main(); systemsOutRule.assertContains( "Connected with pool with InitialChannelCount: 10, MinChannelCount: 5, MaxChannelCount:" diff --git a/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java b/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java index ff8365023..09823479f 100644 --- a/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/QuickstartSampleIT.java @@ -30,7 +30,7 @@ /** Tests for quickstart sample. */ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -class QuickstartSampleIT { +public class QuickstartSampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @@ -43,18 +43,18 @@ private static final void deleteTestEntity() { } @Before - void setUp() { + public void setUp() { deleteTestEntity(); } @After - void tearDown() { + public void tearDown() { System.setOut(null); deleteTestEntity(); } @Test - void testQuickstart() throws Exception { + public void testQuickstart() throws Exception { QuickstartSample.main(); systemsOutRule.assertContains("Saved sampletask1: Buy milk"); systemsOutRule.assertContains("Retrieved sampletask1: Buy milk"); diff --git a/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java b/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java index c8950a88f..65a5ef3f3 100644 --- a/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/aggregation/AggregationQuerySampleTestIT.java @@ -30,14 +30,14 @@ import org.junit.Rule; import org.junit.Test; -class AggregationQuerySampleTestIT { +public class AggregationQuerySampleTestIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - void setUp() throws Exception { + public void setUp() throws Exception { // Retrieving and deleting all the 'Task' entities. KeyQuery allKeysQuery = Query.newKeyQueryBuilder().setKind("Task").build(); QueryResults allKeys = datastore.run(allKeysQuery); @@ -46,33 +46,33 @@ void setUp() throws Exception { } @Test - void testAggregationQueryAndCountAggregationSample() { + public void testAggregationQueryAndCountAggregationSample() { CountAggregationOnKind.invoke(); systemsOutRule.assertContains("Total tasks count is 3"); systemsOutRule.assertContains("Total tasks (accessible from default alias) is 3"); } @Test - void testAggregationQueryAndCountAggregationWithLimitSample() { + public void testAggregationQueryAndCountAggregationWithLimitSample() { CountAggregationWithLimit.invoke(); systemsOutRule.assertContains("We have at least 2 tasks"); } @Test - void testAggregationQueryAndCountAggregationWithOrderBySample() { + public void testAggregationQueryAndCountAggregationWithOrderBySample() { CountAggregationWithOrderBy.invoke(); systemsOutRule.assertContains("Total 2 tasks found with priority field"); } @Test - void testAggregationQueryAndCountAggregationWithPropertyFilterSample() { + public void testAggregationQueryAndCountAggregationWithPropertyFilterSample() { CountAggregationWithPropertyFilter.invoke(); systemsOutRule.assertContains("Total completed tasks count is 2"); systemsOutRule.assertContains("Total remaining tasks count is 1"); } @Test - void testAggregationQueryAndCountAggregationSampleWithGqlQuery() { + public void testAggregationQueryAndCountAggregationSampleWithGqlQuery() { CountAggregationWithGqlQuery.invoke(); systemsOutRule.assertContains("We have at least 2 tasks"); systemsOutRule.assertContains("Total tasks count is 3"); @@ -80,68 +80,68 @@ void testAggregationQueryAndCountAggregationSampleWithGqlQuery() { } @Test - void testAggregationQueryAndCountWithStaleRead() throws InterruptedException { + public void testAggregationQueryAndCountWithStaleRead() throws InterruptedException { CountAggregationWithStaleRead.invoke(); systemsOutRule.assertContains("Latest tasks count is 3"); systemsOutRule.assertContains("Stale tasks count is 2"); } @Test - void testAggregationQueryAndCountWithTransaction() throws InterruptedException { + public void testAggregationQueryAndCountWithTransaction() throws InterruptedException { assertThrows(Exception.class, CountAggregationInTransaction::invoke); systemsOutRule.assertContains("Found existing 2 tasks, rolling back"); } @Test - void testSumAggregationWithKind() { + public void testSumAggregationWithKind() { SumAggregationOnKind.invoke(); systemsOutRule.assertContains("Total sales is 239"); } @Test - void testAvgAggregationWithKind() { + public void testAvgAggregationWithKind() { AvgAggregationOnKind.invoke(); systemsOutRule.assertContains("Average sales is 79.66666667"); } @Test - void testSumAggregationWithPropertyFilter() { + public void testSumAggregationWithPropertyFilter() { SumAggregationWithPropertyFilter.invoke(); systemsOutRule.assertContains("Customer 1 sales sum is 184"); } @Test - void testAvgAggregationWithPropertyFilter() { + public void testAvgAggregationWithPropertyFilter() { AvgAggregationWithPropertyFilter.invoke(); systemsOutRule.assertContains("Customer 1 sales avg is 92"); } @Test - void testSumAggregationWithLimit() { + public void testSumAggregationWithLimit() { SumAggregationWithLimit.invoke(); systemsOutRule.assertContains("We have a minimum sales sum of 144."); } @Test - void testAvgAggregationWithLimit() { + public void testAvgAggregationWithLimit() { AvgAggregationWithLimit.invoke(); systemsOutRule.assertContains("Average with limit 2 is 72."); } @Test - void testSumAggregationWithOrderBy() { + public void testSumAggregationWithOrderBy() { SumAggregationWithOrderBy.invoke(); systemsOutRule.assertContains("Total sum of 144 with valid customerId field"); } @Test - void testAvgAggregationWithOrderBy() { + public void testAvgAggregationWithOrderBy() { AvgAggregationWithOrderBy.invoke(); systemsOutRule.assertContains("Total avg of 72 with valid customerId field"); } @Test - void testMultipleAggregationsInStructuredQuery() { + public void testMultipleAggregationsInStructuredQuery() { MultipleAggregationsInStructuredQuery.invoke(); systemsOutRule.assertContains("Total sales count: 3"); systemsOutRule.assertContains("Sum of sales: 239"); @@ -149,7 +149,7 @@ void testMultipleAggregationsInStructuredQuery() { } @Test - void testMultipleAggregationsInGQLQuery() { + public void testMultipleAggregationsInGQLQuery() { MultipleAggregationsInGqlQuery.invoke(); systemsOutRule.assertContains("Total sales count: 3"); systemsOutRule.assertContains("Sum of sales: 239"); diff --git a/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java b/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java index 2cc30179c..8e3fa4c10 100644 --- a/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/filters/MultiIneqQuerySampleIT.java @@ -30,7 +30,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -class MultiIneqQuerySampleIT { +public class MultiIneqQuerySampleIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); @@ -41,7 +41,7 @@ class MultiIneqQuerySampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - void setUp() { + public void setUp() { employeeKey1 = datastore.newKeyFactory().setKind("employees").newKey("employee1"); Entity employee1 = Entity.newBuilder(employeeKey1) @@ -72,14 +72,14 @@ void setUp() { } @After - void tearDown() { + public void tearDown() { datastore.delete(employeeKey1); datastore.delete(employeeKey2); datastore.delete(employeeKey3); } @Test - void testIndexingConsiderationQuery() throws Exception { + public void testIndexingConsiderationQuery() throws Exception { // Act IndexingConsiderationQuery.invoke(); @@ -88,7 +88,7 @@ void testIndexingConsiderationQuery() throws Exception { } @Test - void testOrderFieldsQuery() throws Exception { + public void testOrderFieldsQuery() throws Exception { // Act OrderFieldsQuery.invoke(); diff --git a/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java b/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java index 2637bcf0e..a1b84cdfd 100644 --- a/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/filters/OrFilterQuerySampleIT.java @@ -30,7 +30,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -class OrFilterQuerySampleIT { +public class OrFilterQuerySampleIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); private final String fieldName = "description"; @@ -41,7 +41,7 @@ class OrFilterQuerySampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - void setUp() { + public void setUp() { taskKey1 = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); Entity task1 = Entity.newBuilder(taskKey1).set(fieldName, "Buy milk").build(); @@ -53,13 +53,13 @@ void setUp() { } @After - void tearDown() { + public void tearDown() { datastore.delete(taskKey1); datastore.delete(taskKey2); } @Test - void testOrFilterQuery() throws Exception { + public void testOrFilterQuery() throws Exception { // Act OrFilterQuery.invoke(); diff --git a/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java b/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java index 7366c91bb..6003b4a0f 100644 --- a/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java +++ b/samples/snippets/src/test/java/com/example/datastore/queryprofile/QueryProfileSampleIT.java @@ -30,7 +30,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") -class QueryProfileSampleIT { +public class QueryProfileSampleIT { private final Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); private final String fieldName = "description"; @@ -41,7 +41,7 @@ class QueryProfileSampleIT { @Rule public final SystemsOutRule systemsOutRule = new SystemsOutRule(); @Before - void setUp() { + public void setUp() { taskKey1 = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); Entity task1 = Entity.newBuilder(taskKey1).set(fieldName, "Buy milk").build(); @@ -53,13 +53,13 @@ void setUp() { } @After - void tearDown() { + public void tearDown() { datastore.delete(taskKey1); datastore.delete(taskKey2); } @Test - void testQueryProfileExplain() throws Exception { + public void testQueryProfileExplain() throws Exception { // Act QueryProfileExplain.invoke(); @@ -69,7 +69,7 @@ void testQueryProfileExplain() throws Exception { } @Test - void testQueryProfileExplainAggregation() throws Exception { + public void testQueryProfileExplainAggregation() throws Exception { // Act QueryProfileExplainAggregation.invoke(); @@ -79,7 +79,7 @@ void testQueryProfileExplainAggregation() throws Exception { } @Test - void testQueryProfileExplainAnalyze() throws Exception { + public void testQueryProfileExplainAnalyze() throws Exception { // Act QueryProfileExplainAnalyze.invoke(); @@ -91,7 +91,7 @@ void testQueryProfileExplainAnalyze() throws Exception { } @Test - void testQueryProfileExplainAnalyzeAggregation() throws Exception { + public void testQueryProfileExplainAnalyzeAggregation() throws Exception { // Act QueryProfileExplainAnalyzeAggregation.invoke(); diff --git a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java index 9f10ed454..13701eb2d 100644 --- a/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java +++ b/samples/snippets/src/test/java/com/google/datastore/snippets/ConceptsTest.java @@ -80,7 +80,7 @@ /** Contains Cloud Datastore snippets demonstrating concepts for documentation. */ @RunWith(JUnit4.class) -class ConceptsTest { +public class ConceptsTest { private static final LocalDatastoreHelper HELPER = LocalDatastoreHelper.create(1.0); private static final FullEntity TEST_FULL_ENTITY = FullEntity.newBuilder().build(); @@ -103,7 +103,7 @@ class ConceptsTest { * @throws InterruptedException if there are errors starting the local Datastore */ @BeforeClass - static void beforeClass() throws IOException, InterruptedException { + public static void beforeClass() throws IOException, InterruptedException { HELPER.start(); } @@ -112,7 +112,7 @@ static void beforeClass() throws IOException, InterruptedException { * used for testing. */ @Before - void setUp() { + public void setUp() { datastore = HELPER.getOptions().toBuilder().setNamespace("ghijklmnop").build().getService(); StructuredQuery query = Query.newKeyQueryBuilder().build(); QueryResults result = datastore.run(query); @@ -132,7 +132,7 @@ void setUp() { } @After - void tearDown() throws Exception { + public void tearDown() throws Exception { KeyQuery taskQuery = Query.newKeyQueryBuilder().setKind("Task").build(); Key[] taskKeysToDelete = Iterators.toArray(datastoreRealBackend.run(taskQuery), Key.class); datastoreRealBackend.delete(taskKeysToDelete); @@ -145,7 +145,7 @@ void tearDown() throws Exception { * @throws InterruptedException if there are errors stopping the local Datastore */ @AfterClass - static void afterClass() throws IOException, InterruptedException, TimeoutException { + public static void afterClass() throws IOException, InterruptedException, TimeoutException { HELPER.stopDuration(java.time.Duration.ofMinutes(1)); } @@ -154,7 +154,7 @@ private void assertValidKey(Key taskKey) { } @Test - void testIncompleteKey() { + public void testIncompleteKey() { // [START datastore_incomplete_key] KeyFactory keyFactory = datastore.newKeyFactory().setKind("Task"); Key taskKey = datastore.allocateId(keyFactory.newKey()); @@ -163,7 +163,7 @@ void testIncompleteKey() { } @Test - void testNamedKey() { + public void testNamedKey() { // [START datastore_named_key] Key taskKey = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); // [END datastore_named_key] @@ -171,7 +171,7 @@ void testNamedKey() { } @Test - void testKeyWithParent() { + public void testKeyWithParent() { // [START datastore_key_with_parent] Key taskKey = datastore @@ -184,7 +184,7 @@ void testKeyWithParent() { } @Test - void testKeyWithMultilevelParent() { + public void testKeyWithMultilevelParent() { // [START datastore_key_with_multilevel_parent] KeyFactory keyFactory = datastore @@ -202,7 +202,7 @@ private void assertValidEntity(Entity original) { } @Test - void testEntityWithParent() { + public void testEntityWithParent() { // [START datastore_entity_with_parent] Key taskKey = datastore @@ -222,7 +222,7 @@ void testEntityWithParent() { } @Test - void testProperties() { + public void testProperties() { // [START datastore_properties] Entity task = Entity.newBuilder(taskKey) @@ -240,7 +240,7 @@ void testProperties() { } @Test - void testArrayValue() { + public void testArrayValue() { // [START datastore_array_value] Entity task = Entity.newBuilder(taskKey) @@ -252,7 +252,7 @@ void testArrayValue() { } @Test - void testBasicEntity() { + public void testBasicEntity() { // [START datastore_basic_entity] Key taskKey = datastore.newKeyFactory().setKind("Task").newKey("sampleTask"); Entity task = @@ -267,7 +267,7 @@ void testBasicEntity() { } @Test - void testUpsert() { + public void testUpsert() { // [START datastore_upsert] Entity task = Entity.newBuilder(keyFactory.newKey("sampleTask")).build(); datastore.put(task); @@ -276,7 +276,7 @@ void testUpsert() { } @Test - void testInsert() { + public void testInsert() { // [START datastore_insert] Key taskKey = datastore.add(FullEntity.newBuilder(keyFactory.newKey()).build()).getKey(); // [END datastore_insert] @@ -284,7 +284,7 @@ void testInsert() { } @Test - void testLookup() { + public void testLookup() { datastore.put(testEntity); // [START datastore_lookup] Entity task = datastore.get(taskKey); @@ -293,7 +293,7 @@ void testLookup() { } @Test - void testUpdate() { + public void testUpdate() { datastore.put(testEntity); // [START datastore_update] Entity task; @@ -312,7 +312,7 @@ void testUpdate() { } @Test - void testDelete() { + public void testDelete() { datastore.put(testEntity); // [START datastore_delete] datastore.delete(taskKey); @@ -340,7 +340,7 @@ private List setUpBatchTests(Key taskKey1, Key taskKey2) { } @Test - void testBatchUpsert() { + public void testBatchUpsert() { // [START datastore_batch_upsert] FullEntity task1 = FullEntity.newBuilder(keyFactory.newKey()) @@ -365,7 +365,7 @@ void testBatchUpsert() { } @Test - void testBatchLookup() { + public void testBatchLookup() { Key taskKey1 = keyFactory.newKey(1); Key taskKey2 = keyFactory.newKey(2); List expectedTasks = setUpBatchTests(taskKey1, taskKey2); @@ -377,7 +377,7 @@ void testBatchLookup() { } @Test - void testBatchDelete() { + public void testBatchDelete() { Key taskKey1 = keyFactory.newKey(1); Key taskKey2 = keyFactory.newKey(2); setUpBatchTests(taskKey1, taskKey2); @@ -423,7 +423,7 @@ private void assertInvalidQuery(Query query) { } @Test - void testBasicQuery() { + public void testBasicQuery() { setUpQueryTests(); // [START datastore_basic_query] Query query = @@ -439,7 +439,7 @@ void testBasicQuery() { } @Test - void testRunQuery() { + public void testRunQuery() { setUpQueryTests(); Query query = Query.newEntityQueryBuilder().setKind("Task").build(); // [START datastore_run_query] @@ -450,7 +450,7 @@ void testRunQuery() { } @Test - void testPropertyFilter() { + public void testPropertyFilter() { setUpQueryTests(); // [START datastore_property_filter] Query query = @@ -463,7 +463,7 @@ void testPropertyFilter() { } @Test - void testCompositeFilter() { + public void testCompositeFilter() { setUpQueryTests(); // [START datastore_composite_filter] Query query = @@ -478,7 +478,7 @@ void testCompositeFilter() { } @Test - void testKeyFilter() { + public void testKeyFilter() { setUpQueryTests(); // [START datastore_key_filter] Query query = @@ -491,7 +491,7 @@ void testKeyFilter() { } @Test - void testAscendingSort() { + public void testAscendingSort() { setUpQueryTests(); // [START datastore_ascending_sort] Query query = @@ -501,7 +501,7 @@ void testAscendingSort() { } @Test - void testDescendingSort() { + public void testDescendingSort() { setUpQueryTests(); // [START datastore_descending_sort] Query query = @@ -511,7 +511,7 @@ void testDescendingSort() { } @Test - void testMultiSort() { + public void testMultiSort() { setUpQueryTests(); // [START datastore_multi_sort] Query query = @@ -524,7 +524,7 @@ void testMultiSort() { } @Test - void testKindlessQuery() { + public void testKindlessQuery() { Key lastSeenKey = keyFactory.newKey("a"); setUpQueryTests(); // [START datastore_kindless_query] @@ -535,7 +535,7 @@ void testKindlessQuery() { } @Test - void testAncestorQuery() { + public void testAncestorQuery() { setUpQueryTests(); // [START datastore_ancestor_query] Query query = @@ -550,7 +550,7 @@ void testAncestorQuery() { } @Test - void testProjectionQuery() { + public void testProjectionQuery() { setUpQueryTests(); // [START datastore_projection_query] Query query = @@ -563,7 +563,7 @@ void testProjectionQuery() { } @Test - void testRunProjectionQuery() { + public void testRunProjectionQuery() { setUpQueryTests(); Query query = Query.newProjectionEntityQueryBuilder() @@ -585,7 +585,7 @@ void testRunProjectionQuery() { } @Test - void testKeysOnlyQuery() { + public void testKeysOnlyQuery() { setUpQueryTests(); // [START datastore_keys_only_query] Query query = Query.newKeyQueryBuilder().setKind("Task").build(); @@ -594,7 +594,7 @@ void testKeysOnlyQuery() { } @Test - void testDistinctOnQuery() { + public void testDistinctOnQuery() { setUpQueryTests(); // [START datastore_distinct_on_query] Query query = @@ -609,7 +609,7 @@ void testDistinctOnQuery() { } @Test - void testArrayValueInequalityRange() { + public void testArrayValueInequalityRange() { setUpQueryTests(); // [START datastore_array_value_inequality_range] Query query = @@ -625,7 +625,7 @@ void testArrayValueInequalityRange() { } @Test - void testArrayValueEquality() { + public void testArrayValueEquality() { setUpQueryTests(); // [START datastore_array_value_equality] Query query = @@ -640,7 +640,7 @@ void testArrayValueEquality() { } @Test - void testInequalityRange() { + public void testInequalityRange() { setUpQueryTests(); // [START datastore_inequality_range] Query query = @@ -655,7 +655,7 @@ void testInequalityRange() { } @Test - void testInequalityInvalid() { + public void testInequalityInvalid() { // [START datastore_inequality_invalid] Query query = Query.newEntityQueryBuilder() @@ -669,7 +669,7 @@ void testInequalityInvalid() { } @Test - void testEqualAndInequalityRange() { + public void testEqualAndInequalityRange() { setUpQueryTests(); // [START datastore_equal_and_inequality_range] Query query = @@ -686,7 +686,7 @@ void testEqualAndInequalityRange() { } @Test - void testInequalitySort() { + public void testInequalitySort() { setUpQueryTests(); // [START datastore_inequality_sort] Query query = @@ -700,7 +700,7 @@ void testInequalitySort() { } @Test - void testInequalitySortInvalidNotSame() { + public void testInequalitySortInvalidNotSame() { // [START datastore_inequality_sort_invalid_not_same] Query query = Query.newEntityQueryBuilder() @@ -713,7 +713,7 @@ void testInequalitySortInvalidNotSame() { } @Test - void testInequalitySortInvalidNotFirst() { + public void testInequalitySortInvalidNotFirst() { // [START datastore_inequality_sort_invalid_not_first] Query query = Query.newEntityQueryBuilder() @@ -726,7 +726,7 @@ void testInequalitySortInvalidNotFirst() { } @Test - void testLimit() { + public void testLimit() { setUpQueryTests(); // [START datastore_limit] Query query = Query.newEntityQueryBuilder().setKind("Task").setLimit(5).build(); @@ -735,7 +735,7 @@ void testLimit() { } @Test - void testCursorPaging() { + public void testCursorPaging() { setUpQueryTests(); datastore.put(testEntity); Cursor nextPageCursor = cursorPaging(1, null); @@ -762,7 +762,7 @@ private Cursor cursorPaging(int pageSize, Cursor pageCursor) { } @Test - void testEventualConsistentQuery() { + public void testEventualConsistentQuery() { setUpQueryTests(); // [START datastore_eventual_consistent_query] Query query = @@ -778,7 +778,7 @@ void testEventualConsistentQuery() { } @Test - void testUnindexedPropertyQuery() { + public void testUnindexedPropertyQuery() { setUpQueryTests(); // [START datastore_unindexed_property_query] Query query = @@ -792,7 +792,7 @@ void testUnindexedPropertyQuery() { } @Test - void testExplodingProperties() { + public void testExplodingProperties() { // [START datastore_exploding_properties] Entity task = Entity.newBuilder(taskKey) @@ -819,7 +819,7 @@ private void assertSuccessfulTransfer(Key from, Key to) { } @Test - void testTransactionalUpdate() { + public void testTransactionalUpdate() { List keys = setUpTransferTests(); transferFunds(keys.get(0), keys.get(1), 10); assertSuccessfulTransfer(keys.get(0), keys.get(1)); @@ -848,7 +848,7 @@ void transferFunds(Key fromKey, Key toKey, long amount) { // [END datastore_transactional_update] @Test - void testTransactionalRetry() { + public void testTransactionalRetry() { List keys = setUpTransferTests(); Key fromKey = keys.get(0); Key toKey = keys.get(1); @@ -871,7 +871,7 @@ void testTransactionalRetry() { } @Test - void testTransactionalGetOrCreate() { + public void testTransactionalGetOrCreate() { // [START datastore_transactional_get_or_create] Entity task; Transaction txn = datastore.newTransaction(); @@ -892,7 +892,7 @@ void testTransactionalGetOrCreate() { } @Test - void testTransactionalSingleEntityGroupReadOnly() { + public void testTransactionalSingleEntityGroupReadOnly() { setUpQueryTests(); Key taskListKey = datastore.newKeyFactory().setKind("TaskList").newKey("default"); Entity taskListEntity = Entity.newBuilder(taskListKey).build(); @@ -924,7 +924,7 @@ void testTransactionalSingleEntityGroupReadOnly() { } @Test - void testNamespaceRunQuery() { + public void testNamespaceRunQuery() { setUpQueryTests(); // [START datastore_namespace_run_query] KeyFactory keyFactory = datastore.newKeyFactory().setKind("__namespace__"); @@ -948,7 +948,7 @@ void testNamespaceRunQuery() { } @Test - void testKindRunQuery() { + public void testKindRunQuery() { setUpQueryTests(); // [START datastore_kind_run_query] Query query = Query.newKeyQueryBuilder().setKind("__kind__").build(); @@ -962,7 +962,7 @@ void testKindRunQuery() { } @Test - void testPropertyRunQuery() { + public void testPropertyRunQuery() { setUpQueryTests(); // [START datastore_property_run_query] Query query = Query.newKeyQueryBuilder().setKind("__property__").build(); @@ -996,7 +996,7 @@ void testPropertyRunQuery() { } @Test - void testPropertyByKindRunQuery() { + public void testPropertyByKindRunQuery() { setUpQueryTests(); // [START datastore_property_by_kind_run_query] Key key = datastore.newKeyFactory().setKind("__kind__").newKey("Task"); @@ -1035,7 +1035,7 @@ void testPropertyByKindRunQuery() { } @Test - void testPropertyFilteringRunQuery() { + public void testPropertyFilteringRunQuery() { setUpQueryTests(); // [START datastore_property_filtering_run_query] Key startKey = @@ -1069,7 +1069,7 @@ void testPropertyFilteringRunQuery() { } @Test - void testEqQuerySorted() { + public void testEqQuerySorted() { setUpQueryTests(); // [START datastore_eq_query_sorted] Query query = @@ -1113,7 +1113,7 @@ private void setUpQueryTestsRealBackend() { } @Test - void testInQuery() { + public void testInQuery() { setUpQueryTestsRealBackend(); // [START datastore_in_query] Query query = @@ -1126,7 +1126,7 @@ void testInQuery() { } @Test - void testNotEqualsQuery() { + public void testNotEqualsQuery() { setUpQueryTestsRealBackend(); // [START datastore_not_equals_query] Query query = @@ -1139,7 +1139,7 @@ void testNotEqualsQuery() { } @Test - void testNotInQuery() { + public void testNotInQuery() { setUpQueryTestsRealBackend(); // [START datastore_not_in_query] Query query = @@ -1152,7 +1152,7 @@ void testNotInQuery() { } @Test - void testInQuerySorted() { + public void testInQuerySorted() { setUpQueryTestsRealBackend(); // [START datastore_in_query_sorted] Query query = @@ -1166,7 +1166,7 @@ void testInQuerySorted() { } @Test - void testStaleReads() throws InterruptedException { + public void testStaleReads() throws InterruptedException { setUpQueryTestsRealBackend(); // waiting for 6 seconds, so that we can query with read time of 5 seconds ago TimeUnit.SECONDS.sleep(6); From 638bc11baedfdd102167c59c73a720546d4815e8 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 12 Jan 2026 21:35:48 -0500 Subject: [PATCH 4/7] chore: Do not fail when there is no public javadoc in tests --- datastore-v1-proto-client/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/datastore-v1-proto-client/pom.xml b/datastore-v1-proto-client/pom.xml index 3ce284c3f..5f419278f 100644 --- a/datastore-v1-proto-client/pom.xml +++ b/datastore-v1-proto-client/pom.xml @@ -124,6 +124,14 @@ -Xmx2048m + + org.apache.maven.plugins + maven-javadoc-plugin + + + false + + From 3472bbfed6af67dc25dd1b8b3086fd76fb6e0554 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 12 Jan 2026 22:07:59 -0500 Subject: [PATCH 5/7] chore: Add javadoc config to read package private scope for tests --- datastore-v1-proto-client/pom.xml | 8 -------- pom.xml | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/datastore-v1-proto-client/pom.xml b/datastore-v1-proto-client/pom.xml index 5f419278f..3ce284c3f 100644 --- a/datastore-v1-proto-client/pom.xml +++ b/datastore-v1-proto-client/pom.xml @@ -124,14 +124,6 @@ -Xmx2048m - - org.apache.maven.plugins - maven-javadoc-plugin - - - false - - diff --git a/pom.xml b/pom.xml index a26e518c2..78c0ed72f 100644 --- a/pom.xml +++ b/pom.xml @@ -239,6 +239,32 @@ + + + org.apache.maven.plugins + maven-javadoc-plugin + + + + + package + false + + + + + attach-javadocs + + jar + + + + protected + + + + + From 7d88e758b0a69a19b907d23a99558971d07bf64d Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 12 Jan 2026 22:28:10 -0500 Subject: [PATCH 6/7] chore: Use junit5 test injector --- google-cloud-datastore/pom.xml | 2 +- .../cloud/datastore/it/ITTracingTest.java | 36 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/google-cloud-datastore/pom.xml b/google-cloud-datastore/pom.xml index cd14c9010..a498fc09a 100644 --- a/google-cloud-datastore/pom.xml +++ b/google-cloud-datastore/pom.xml @@ -218,7 +218,7 @@ com.google.testparameterinjector - test-parameter-injector + test-parameter-injector-junit5 1.17 test diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java index 442e9fd7d..b248a2c73 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java @@ -44,8 +44,8 @@ import com.google.cloud.datastore.Transaction; import com.google.cloud.datastore.testing.RemoteDatastoreHelper; import com.google.common.base.Preconditions; -import com.google.testing.junit.testparameterinjector.TestParameter; -import com.google.testing.junit.testparameterinjector.TestParameterInjector; +import com.google.testing.junit.testparameterinjector.junit5.TestParameter; +import com.google.testing.junit.testparameterinjector.junit5.TestParameterInjectorTest; import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; @@ -71,10 +71,7 @@ import javax.annotation.Nullable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; -@RunWith(TestParameterInjector.class) class ITTracingTest { protected boolean isUsingGlobalOpenTelemetrySDK() { return useGlobalOpenTelemetrySDK; @@ -110,7 +107,8 @@ protected String datastoreNamedDatabase() { protected Datastore datastore; private static RemoteDatastoreHelper remoteDatastoreHelper; - @TestParameter boolean useGlobalOpenTelemetrySDK; + @TestParameter + boolean useGlobalOpenTelemetrySDK; @TestParameter({ /*(default)*/ @@ -381,7 +379,7 @@ public void setBar(int bar) { } } - @Test + @TestParameterInjectorTest void lookupTraceTest() throws Exception { Entity entity = datastore.get(KEY1); assertNull(entity); @@ -405,7 +403,7 @@ void lookupTraceTest() throws Exception { .build())); } - @Test + @TestParameterInjectorTest void allocateIdsTraceTest() throws Exception { String kind1 = "kind1"; KeyFactory keyFactory = datastore.newKeyFactory().setKind(kind1); @@ -419,7 +417,7 @@ void allocateIdsTraceTest() throws Exception { assertSpanHierarchy(SPAN_NAME_ALLOCATE_IDS); } - @Test + @TestParameterInjectorTest void reserveIdsTraceTest() throws Exception { KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind"); Key key1 = keyFactory.newKey(10); @@ -434,7 +432,7 @@ void reserveIdsTraceTest() throws Exception { assertSpanHierarchy(SPAN_NAME_RESERVE_IDS); } - @Test + @TestParameterInjectorTest void commitTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); Entity response = datastore.add(entity1); @@ -447,7 +445,7 @@ void commitTraceTest() throws Exception { assertSpanHierarchy(SPAN_NAME_COMMIT); } - @Test + @TestParameterInjectorTest void putTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); Entity response = datastore.put(entity1); @@ -460,7 +458,7 @@ void putTraceTest() throws Exception { assertSpanHierarchy(SPAN_NAME_COMMIT); } - @Test + @TestParameterInjectorTest void updateTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); @@ -500,7 +498,7 @@ void updateTraceTest() throws Exception { assertSpanHierarchy(SPAN_NAME_COMMIT); } - @Test + @TestParameterInjectorTest void deleteTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_key", "test_value").build(); Entity response = datastore.put(entity1); @@ -544,7 +542,7 @@ void deleteTraceTest() throws Exception { .build())); } - @Test + @TestParameterInjectorTest void runQueryTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); @@ -586,7 +584,7 @@ void runQueryTraceTest() throws Exception { .build())); } - @Test + @TestParameterInjectorTest void runAggregationQueryTraceTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1) @@ -641,7 +639,7 @@ void runAggregationQueryTraceTest() throws Exception { assertSpanHierarchy(SPAN_NAME_RUN_AGGREGATION_QUERY); } - @Test + @TestParameterInjectorTest void newTransactionReadWriteTraceTest() throws Exception { // Transaction.Begin Transaction transaction = datastore.newTransaction(); @@ -689,7 +687,7 @@ void newTransactionReadWriteTraceTest() throws Exception { .build())); } - @Test + @TestParameterInjectorTest void newTransactionQueryTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); Entity entity2 = Entity.newBuilder(KEY2).set("test_field", "test_value2").build(); @@ -735,7 +733,7 @@ void newTransactionQueryTest() throws Exception { .build())); } - @Test + @TestParameterInjectorTest void newTransactionRollbackTest() throws Exception { Entity entity1 = Entity.newBuilder(KEY1).set("pepper_type", "jalapeno").build(); Entity entity2 = Entity.newBuilder(KEY2).set("pepper_type", "habanero").build(); @@ -799,7 +797,7 @@ void newTransactionRollbackTest() throws Exception { .build())); } - @Test + @TestParameterInjectorTest void runInTransactionQueryTest() throws Exception { // Set up Entity entity1 = Entity.newBuilder(KEY1).set("test_field", "test_value1").build(); From 0ec19f19e6ab7c1de951fb6fcfa56df23f490f1e Mon Sep 17 00:00:00 2001 From: cloud-java-bot Date: Tue, 13 Jan 2026 03:30:25 +0000 Subject: [PATCH 7/7] chore: generate libraries at Tue Jan 13 03:28:34 UTC 2026 --- .../test/java/com/google/cloud/datastore/it/ITTracingTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java index b248a2c73..4858440b4 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITTracingTest.java @@ -107,8 +107,7 @@ protected String datastoreNamedDatabase() { protected Datastore datastore; private static RemoteDatastoreHelper remoteDatastoreHelper; - @TestParameter - boolean useGlobalOpenTelemetrySDK; + @TestParameter boolean useGlobalOpenTelemetrySDK; @TestParameter({ /*(default)*/