From e94e746a3fb3a5913e96b100ed55635f329f0622 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 03:30:21 +0000 Subject: [PATCH 01/17] Add JUnit 5 support for showcase. --- showcase/gapic-showcase/pom.xml | 16 ++++++++++++++++ showcase/pom.xml | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 5bdc31a945..b30297f5eb 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -136,6 +136,22 @@ junit test + + + org.junit.platform + junit-platform-launcher + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.vintage + junit-vintage-engine + test + com.google.truth truth diff --git a/showcase/pom.xml b/showcase/pom.xml index 32c5cfc469..850d9d9f7d 100644 --- a/showcase/pom.xml +++ b/showcase/pom.xml @@ -59,6 +59,13 @@ 4.13.2 test + + org.junit + junit-bom + 5.10.2 + pom + import + From 3d9f53091e828e5b119cb8cd77718640136a5888 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 05:48:24 +0000 Subject: [PATCH 02/17] migrate unit tests. --- .../v1beta1/ComplianceClientHttpJsonTest.java | 212 +++--- .../v1beta1/ComplianceClientTest.java | 402 +++++------ .../v1beta1/EchoClientHttpJsonTest.java | 172 ++--- .../showcase/v1beta1/EchoClientTest.java | 280 ++++---- .../v1beta1/IdentityClientHttpJsonTest.java | 182 ++--- .../showcase/v1beta1/IdentityClientTest.java | 238 +++---- .../v1beta1/MessagingClientHttpJsonTest.java | 456 ++++++------ .../showcase/v1beta1/MessagingClientTest.java | 654 +++++++++--------- .../SequenceServiceClientHttpJsonTest.java | 184 ++--- .../v1beta1/SequenceServiceClientTest.java | 235 +++---- .../v1beta1/TestingClientHttpJsonTest.java | 184 ++--- .../showcase/v1beta1/TestingClientTest.java | 234 +++---- 12 files changed, 1722 insertions(+), 1711 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java index 706ab50b10..3ec388b992 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java @@ -50,20 +50,20 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class ComplianceClientHttpJsonTest { +class ComplianceClientHttpJsonTest { private static MockHttpService mockService; private static ComplianceClient client; - @BeforeClass - public static void startStaticServer() throws IOException { + @BeforeAll + static void startStaticServer() throws IOException { mockService = new MockHttpService( HttpJsonComplianceStub.getMethodDescriptors(), ComplianceSettings.getDefaultEndpoint()); @@ -78,21 +78,21 @@ public static void startStaticServer() throws IOException { client = ComplianceClient.create(settings); } - @AfterClass - public static void stopServer() { + @AfterAll + static void stopServer() { client.close(); } - @Before - public void setUp() {} + @BeforeEach + void setUp() {} - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { mockService.reset(); } @Test - public void repeatDataBodyTest() throws Exception { + void repeatDataBodyTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -115,10 +115,10 @@ public void repeatDataBodyTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBody(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -126,14 +126,14 @@ public void repeatDataBodyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataBodyExceptionTest() throws Exception { + void repeatDataBodyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -154,14 +154,14 @@ public void repeatDataBodyExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBody(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataBodyInfoTest() throws Exception { + void repeatDataBodyInfoTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -184,10 +184,10 @@ public void repeatDataBodyInfoTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyInfo(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -195,14 +195,14 @@ public void repeatDataBodyInfoTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataBodyInfoExceptionTest() throws Exception { + void repeatDataBodyInfoExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -223,14 +223,14 @@ public void repeatDataBodyInfoExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyInfo(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataQueryTest() throws Exception { + void repeatDataQueryTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -253,10 +253,10 @@ public void repeatDataQueryTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataQuery(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -264,14 +264,14 @@ public void repeatDataQueryTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataQueryExceptionTest() throws Exception { + void repeatDataQueryExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -292,14 +292,14 @@ public void repeatDataQueryExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataQuery(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataSimplePathTest() throws Exception { + void repeatDataSimplePathTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -345,10 +345,10 @@ public void repeatDataSimplePathTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataSimplePath(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -356,14 +356,14 @@ public void repeatDataSimplePathTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataSimplePathExceptionTest() throws Exception { + void repeatDataSimplePathExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -407,14 +407,14 @@ public void repeatDataSimplePathExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataSimplePath(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataPathResourceTest() throws Exception { + void repeatDataPathResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -474,10 +474,10 @@ public void repeatDataPathResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathResource(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -485,14 +485,14 @@ public void repeatDataPathResourceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataPathResourceExceptionTest() throws Exception { + void repeatDataPathResourceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -550,14 +550,14 @@ public void repeatDataPathResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathResource(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataPathTrailingResourceTest() throws Exception { + void repeatDataPathTrailingResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -617,10 +617,10 @@ public void repeatDataPathTrailingResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathTrailingResource(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -628,14 +628,14 @@ public void repeatDataPathTrailingResourceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataPathTrailingResourceExceptionTest() throws Exception { + void repeatDataPathTrailingResourceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -693,14 +693,14 @@ public void repeatDataPathTrailingResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathTrailingResource(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataBodyPutTest() throws Exception { + void repeatDataBodyPutTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -723,10 +723,10 @@ public void repeatDataBodyPutTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPut(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -734,14 +734,14 @@ public void repeatDataBodyPutTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataBodyPutExceptionTest() throws Exception { + void repeatDataBodyPutExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -762,14 +762,14 @@ public void repeatDataBodyPutExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPut(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataBodyPatchTest() throws Exception { + void repeatDataBodyPatchTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -792,10 +792,10 @@ public void repeatDataBodyPatchTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPatch(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -803,14 +803,14 @@ public void repeatDataBodyPatchTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void repeatDataBodyPatchExceptionTest() throws Exception { + void repeatDataBodyPatchExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -831,14 +831,14 @@ public void repeatDataBodyPatchExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPatch(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getEnumTest() throws Exception { + void getEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -849,10 +849,10 @@ public void getEnumTest() throws Exception { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); EnumResponse actualResponse = client.getEnum(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -860,14 +860,14 @@ public void getEnumTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getEnumExceptionTest() throws Exception { + void getEnumExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -876,14 +876,14 @@ public void getEnumExceptionTest() throws Exception { try { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); client.getEnum(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void verifyEnumTest() throws Exception { + void verifyEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -898,10 +898,10 @@ public void verifyEnumTest() throws Exception { .build(); EnumResponse actualResponse = client.verifyEnum(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -909,14 +909,14 @@ public void verifyEnumTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void verifyEnumExceptionTest() throws Exception { + void verifyEnumExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -929,14 +929,14 @@ public void verifyEnumExceptionTest() throws Exception { .setContinent(Continent.forNumber(0)) .build(); client.verifyEnum(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -957,11 +957,11 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -969,14 +969,14 @@ public void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -991,14 +991,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -1015,10 +1015,10 @@ public void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1026,14 +1026,14 @@ public void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1045,14 +1045,14 @@ public void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1070,10 +1070,10 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1081,14 +1081,14 @@ public void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1102,14 +1102,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1126,10 +1126,10 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1137,14 +1137,14 @@ public void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1157,14 +1157,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -1176,10 +1176,10 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1187,14 +1187,14 @@ public void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1207,7 +1207,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java index e1a3d15c2c..d421410d64 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java @@ -50,15 +50,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class ComplianceClientTest { +class ComplianceClientTest { private static MockCompliance mockCompliance; private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; @@ -66,8 +66,8 @@ public class ComplianceClientTest { private LocalChannelProvider channelProvider; private ComplianceClient client; - @BeforeClass - public static void startStaticServer() { + @BeforeAll + static void startStaticServer() { mockCompliance = new MockCompliance(); mockLocations = new MockLocations(); mockIAMPolicy = new MockIAMPolicy(); @@ -78,13 +78,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterClass - public static void stopServer() { + @AfterAll + static void stopServer() { mockServiceHelper.stop(); } - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); ComplianceSettings settings = @@ -95,13 +95,13 @@ public void setUp() throws IOException { client = ComplianceClient.create(settings); } - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { client.close(); } @Test - public void repeatDataBodyTest() throws Exception { + void repeatDataBodyTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -124,30 +124,30 @@ public void repeatDataBodyTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBody(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataBodyExceptionTest() throws Exception { + void repeatDataBodyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -166,14 +166,14 @@ public void repeatDataBodyExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBody(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataBodyInfoTest() throws Exception { + void repeatDataBodyInfoTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -196,30 +196,30 @@ public void repeatDataBodyInfoTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyInfo(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataBodyInfoExceptionTest() throws Exception { + void repeatDataBodyInfoExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -238,14 +238,14 @@ public void repeatDataBodyInfoExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyInfo(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataQueryTest() throws Exception { + void repeatDataQueryTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -268,30 +268,30 @@ public void repeatDataQueryTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataQuery(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataQueryExceptionTest() throws Exception { + void repeatDataQueryExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -310,14 +310,14 @@ public void repeatDataQueryExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataQuery(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataSimplePathTest() throws Exception { + void repeatDataSimplePathTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -340,30 +340,30 @@ public void repeatDataSimplePathTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataSimplePath(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataSimplePathExceptionTest() throws Exception { + void repeatDataSimplePathExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -382,14 +382,14 @@ public void repeatDataSimplePathExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataSimplePath(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataPathResourceTest() throws Exception { + void repeatDataPathResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -412,30 +412,30 @@ public void repeatDataPathResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathResource(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataPathResourceExceptionTest() throws Exception { + void repeatDataPathResourceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -454,14 +454,14 @@ public void repeatDataPathResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathResource(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataPathTrailingResourceTest() throws Exception { + void repeatDataPathTrailingResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -484,30 +484,30 @@ public void repeatDataPathTrailingResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathTrailingResource(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataPathTrailingResourceExceptionTest() throws Exception { + void repeatDataPathTrailingResourceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -526,14 +526,14 @@ public void repeatDataPathTrailingResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathTrailingResource(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataBodyPutTest() throws Exception { + void repeatDataBodyPutTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -556,30 +556,30 @@ public void repeatDataBodyPutTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPut(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataBodyPutExceptionTest() throws Exception { + void repeatDataBodyPutExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -598,14 +598,14 @@ public void repeatDataBodyPutExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPut(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void repeatDataBodyPatchTest() throws Exception { + void repeatDataBodyPatchTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -628,30 +628,30 @@ public void repeatDataBodyPatchTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPatch(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void repeatDataBodyPatchExceptionTest() throws Exception { + void repeatDataBodyPatchExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -670,14 +670,14 @@ public void repeatDataBodyPatchExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPatch(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getEnumTest() throws Exception { + void getEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -688,35 +688,35 @@ public void getEnumTest() throws Exception { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); EnumResponse actualResponse = client.getEnum(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); EnumRequest actualRequest = ((EnumRequest) actualRequests.get(0)); - Assert.assertEquals(request.getUnknownEnum(), actualRequest.getUnknownEnum()); - Assert.assertTrue( + Assertions.assertEquals(request.getUnknownEnum(), actualRequest.getUnknownEnum()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getEnumExceptionTest() throws Exception { + void getEnumExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); try { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); client.getEnum(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void verifyEnumTest() throws Exception { + void verifyEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -731,22 +731,22 @@ public void verifyEnumTest() throws Exception { .build(); EnumResponse actualResponse = client.verifyEnum(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); EnumResponse actualRequest = ((EnumResponse) actualRequests.get(0)); - Assert.assertEquals(request.getRequest(), actualRequest.getRequest()); - Assert.assertEquals(request.getContinent(), actualRequest.getContinent()); - Assert.assertTrue( + Assertions.assertEquals(request.getRequest(), actualRequest.getRequest()); + Assertions.assertEquals(request.getContinent(), actualRequest.getContinent()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void verifyEnumExceptionTest() throws Exception { + void verifyEnumExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -757,14 +757,14 @@ public void verifyEnumExceptionTest() throws Exception { .setContinent(Continent.forNumber(0)) .build(); client.verifyEnum(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -785,25 +785,25 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -816,14 +816,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -837,35 +837,35 @@ public void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -883,23 +883,23 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -911,14 +911,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -935,22 +935,22 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -961,14 +961,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -980,22 +980,22 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1006,7 +1006,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java index 13e8c39eb7..7b966d3f07 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java @@ -57,19 +57,19 @@ import java.util.Map; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class EchoClientHttpJsonTest { +class EchoClientHttpJsonTest { private static MockHttpService mockService; private static EchoClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -85,21 +85,21 @@ public static void startStaticServer() throws IOException { client = EchoClient.create(settings); } - @AfterClass + @AfterAll public static void stopServer() { client.close(); } - @Before - public void setUp() {} + @BeforeEach + void setUp() {} - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { mockService.reset(); } @Test - public void echoTest() throws Exception { + void echoTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -115,10 +115,10 @@ public void echoTest() throws Exception { .build(); EchoResponse actualResponse = client.echo(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -126,14 +126,14 @@ public void echoTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void echoExceptionTest() throws Exception { + void echoExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -147,17 +147,17 @@ public void echoExceptionTest() throws Exception { .setOtherHeader("otherHeader-2026585667") .build(); client.echo(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void expandTest() throws Exception {} + void expandTest() throws Exception {} @Test - public void expandExceptionTest() throws Exception { + void expandExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -165,19 +165,19 @@ public void expandExceptionTest() throws Exception { } @Test - public void collectUnsupportedMethodTest() throws Exception { + void collectUnsupportedMethodTest() throws Exception { // The collect() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - public void chatUnsupportedMethodTest() throws Exception { + void chatUnsupportedMethodTest() throws Exception { // The chat() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - public void pagedExpandTest() throws Exception { + void pagedExpandTest() throws Exception { EchoResponse responsesElement = EchoResponse.newBuilder().build(); PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() @@ -197,11 +197,11 @@ public void pagedExpandTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -209,14 +209,14 @@ public void pagedExpandTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void pagedExpandExceptionTest() throws Exception { + void pagedExpandExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -230,14 +230,14 @@ public void pagedExpandExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpand(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void pagedExpandLegacyTest() throws Exception { + void pagedExpandLegacyTest() throws Exception { PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() .addAllResponses(new ArrayList()) @@ -253,10 +253,10 @@ public void pagedExpandLegacyTest() throws Exception { .build(); PagedExpandResponse actualResponse = client.pagedExpandLegacy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -264,14 +264,14 @@ public void pagedExpandLegacyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void pagedExpandLegacyExceptionTest() throws Exception { + void pagedExpandLegacyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -285,14 +285,14 @@ public void pagedExpandLegacyExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void pagedExpandLegacyMappedTest() throws Exception { + void pagedExpandLegacyMappedTest() throws Exception { PagedExpandResponseList responsesElement = PagedExpandResponseList.newBuilder().build(); PagedExpandLegacyMappedResponse expectedResponse = PagedExpandLegacyMappedResponse.newBuilder() @@ -314,12 +314,12 @@ public void pagedExpandLegacyMappedTest() throws Exception { List> resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals( + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals( expectedResponse.getAlphabetizedMap().entrySet().iterator().next(), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -327,14 +327,14 @@ public void pagedExpandLegacyMappedTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void pagedExpandLegacyMappedExceptionTest() throws Exception { + void pagedExpandLegacyMappedExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -348,14 +348,14 @@ public void pagedExpandLegacyMappedExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacyMapped(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void waitTest() throws Exception { + void waitTest() throws Exception { WaitResponse expectedResponse = WaitResponse.newBuilder().setContent("content951530617").build(); Operation resultOperation = @@ -369,10 +369,10 @@ public void waitTest() throws Exception { WaitRequest request = WaitRequest.newBuilder().build(); WaitResponse actualResponse = client.waitAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -380,14 +380,14 @@ public void waitTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void waitExceptionTest() throws Exception { + void waitExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -396,13 +396,13 @@ public void waitExceptionTest() throws Exception { try { WaitRequest request = WaitRequest.newBuilder().build(); client.waitAsync(request).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - public void blockTest() throws Exception { + void blockTest() throws Exception { BlockResponse expectedResponse = BlockResponse.newBuilder().setContent("content951530617").build(); mockService.addResponse(expectedResponse); @@ -411,10 +411,10 @@ public void blockTest() throws Exception { BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); BlockResponse actualResponse = client.block(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -422,14 +422,14 @@ public void blockTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void blockExceptionTest() throws Exception { + void blockExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -439,14 +439,14 @@ public void blockExceptionTest() throws Exception { BlockRequest request = BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); client.block(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -467,11 +467,11 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -479,14 +479,14 @@ public void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -501,14 +501,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -525,10 +525,10 @@ public void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -536,14 +536,14 @@ public void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -555,14 +555,14 @@ public void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -580,10 +580,10 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -591,14 +591,14 @@ public void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -612,14 +612,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -636,10 +636,10 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -647,14 +647,14 @@ public void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -667,14 +667,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -686,10 +686,10 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -697,14 +697,14 @@ public void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -717,7 +717,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java index 7fdd669677..399067c627 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java @@ -64,15 +64,15 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class EchoClientTest { +class EchoClientTest { private static MockEcho mockEcho; private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; @@ -80,7 +80,7 @@ public class EchoClientTest { private LocalChannelProvider channelProvider; private EchoClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() { mockEcho = new MockEcho(); mockLocations = new MockLocations(); @@ -92,13 +92,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterClass + @AfterAll public static void stopServer() { mockServiceHelper.stop(); } - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); EchoSettings settings = @@ -109,13 +109,13 @@ public void setUp() throws IOException { client = EchoClient.create(settings); } - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { client.close(); } @Test - public void echoTest() throws Exception { + void echoTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -131,25 +131,25 @@ public void echoTest() throws Exception { .build(); EchoResponse actualResponse = client.echo(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); EchoRequest actualRequest = ((EchoRequest) actualRequests.get(0)); - Assert.assertEquals(request.getContent(), actualRequest.getContent()); - Assert.assertEquals(request.getError(), actualRequest.getError()); - Assert.assertEquals(request.getSeverity(), actualRequest.getSeverity()); - Assert.assertEquals(request.getHeader(), actualRequest.getHeader()); - Assert.assertEquals(request.getOtherHeader(), actualRequest.getOtherHeader()); - Assert.assertTrue( + Assertions.assertEquals(request.getContent(), actualRequest.getContent()); + Assertions.assertEquals(request.getError(), actualRequest.getError()); + Assertions.assertEquals(request.getSeverity(), actualRequest.getSeverity()); + Assertions.assertEquals(request.getHeader(), actualRequest.getHeader()); + Assertions.assertEquals(request.getOtherHeader(), actualRequest.getOtherHeader()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void echoExceptionTest() throws Exception { + void echoExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -161,14 +161,14 @@ public void echoExceptionTest() throws Exception { .setOtherHeader("otherHeader-2026585667") .build(); client.echo(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void expandTest() throws Exception { + void expandTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -188,12 +188,12 @@ public void expandTest() throws Exception { callable.serverStreamingCall(request, responseObserver); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void expandExceptionTest() throws Exception { + void expandExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); ExpandRequest request = @@ -210,16 +210,17 @@ public void expandExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void collectTest() throws Exception { + void collectTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -242,12 +243,12 @@ public void collectTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void collectExceptionTest() throws Exception { + void collectExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); EchoRequest request = @@ -266,16 +267,17 @@ public void collectExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void chatTest() throws Exception { + void chatTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -298,12 +300,12 @@ public void chatTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void chatExceptionTest() throws Exception { + void chatExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); EchoRequest request = @@ -322,16 +324,17 @@ public void chatExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void pagedExpandTest() throws Exception { + void pagedExpandTest() throws Exception { EchoResponse responsesElement = EchoResponse.newBuilder().build(); PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() @@ -351,24 +354,24 @@ public void pagedExpandTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); List actualRequests = mockEcho.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); PagedExpandRequest actualRequest = ((PagedExpandRequest) actualRequests.get(0)); - Assert.assertEquals(request.getContent(), actualRequest.getContent()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getContent(), actualRequest.getContent()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void pagedExpandExceptionTest() throws Exception { + void pagedExpandExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -380,14 +383,14 @@ public void pagedExpandExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpand(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void pagedExpandLegacyTest() throws Exception { + void pagedExpandLegacyTest() throws Exception { PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() .addAllResponses(new ArrayList()) @@ -403,23 +406,23 @@ public void pagedExpandLegacyTest() throws Exception { .build(); PagedExpandResponse actualResponse = client.pagedExpandLegacy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); PagedExpandLegacyRequest actualRequest = ((PagedExpandLegacyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getContent(), actualRequest.getContent()); - Assert.assertEquals(request.getMaxResults(), actualRequest.getMaxResults()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getContent(), actualRequest.getContent()); + Assertions.assertEquals(request.getMaxResults(), actualRequest.getMaxResults()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void pagedExpandLegacyExceptionTest() throws Exception { + void pagedExpandLegacyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -431,14 +434,14 @@ public void pagedExpandLegacyExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void pagedExpandLegacyMappedTest() throws Exception { + void pagedExpandLegacyMappedTest() throws Exception { PagedExpandResponseList responsesElement = PagedExpandResponseList.newBuilder().build(); PagedExpandLegacyMappedResponse expectedResponse = PagedExpandLegacyMappedResponse.newBuilder() @@ -460,25 +463,25 @@ public void pagedExpandLegacyMappedTest() throws Exception { List> resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals( + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals( expectedResponse.getAlphabetizedMap().entrySet().iterator().next(), resources.get(0)); List actualRequests = mockEcho.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); PagedExpandRequest actualRequest = ((PagedExpandRequest) actualRequests.get(0)); - Assert.assertEquals(request.getContent(), actualRequest.getContent()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getContent(), actualRequest.getContent()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void pagedExpandLegacyMappedExceptionTest() throws Exception { + void pagedExpandLegacyMappedExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -490,14 +493,14 @@ public void pagedExpandLegacyMappedExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacyMapped(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void waitTest() throws Exception { + void waitTest() throws Exception { WaitResponse expectedResponse = WaitResponse.newBuilder().setContent("content951530617").build(); Operation resultOperation = @@ -511,40 +514,41 @@ public void waitTest() throws Exception { WaitRequest request = WaitRequest.newBuilder().build(); WaitResponse actualResponse = client.waitAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); WaitRequest actualRequest = ((WaitRequest) actualRequests.get(0)); - Assert.assertEquals(request.getEndTime(), actualRequest.getEndTime()); - Assert.assertEquals(request.getTtl(), actualRequest.getTtl()); - Assert.assertEquals(request.getError(), actualRequest.getError()); - Assert.assertEquals(request.getSuccess(), actualRequest.getSuccess()); - Assert.assertTrue( + Assertions.assertEquals(request.getEndTime(), actualRequest.getEndTime()); + Assertions.assertEquals(request.getTtl(), actualRequest.getTtl()); + Assertions.assertEquals(request.getError(), actualRequest.getError()); + Assertions.assertEquals(request.getSuccess(), actualRequest.getSuccess()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void waitExceptionTest() throws Exception { + void waitExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); try { WaitRequest request = WaitRequest.newBuilder().build(); client.waitAsync(request).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void blockTest() throws Exception { + void blockTest() throws Exception { BlockResponse expectedResponse = BlockResponse.newBuilder().setContent("content951530617").build(); mockEcho.addResponse(expectedResponse); @@ -553,23 +557,23 @@ public void blockTest() throws Exception { BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); BlockResponse actualResponse = client.block(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); BlockRequest actualRequest = ((BlockRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResponseDelay(), actualRequest.getResponseDelay()); - Assert.assertEquals(request.getError(), actualRequest.getError()); - Assert.assertEquals(request.getSuccess(), actualRequest.getSuccess()); - Assert.assertTrue( + Assertions.assertEquals(request.getResponseDelay(), actualRequest.getResponseDelay()); + Assertions.assertEquals(request.getError(), actualRequest.getError()); + Assertions.assertEquals(request.getSuccess(), actualRequest.getSuccess()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void blockExceptionTest() throws Exception { + void blockExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -577,14 +581,14 @@ public void blockExceptionTest() throws Exception { BlockRequest request = BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); client.block(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -605,25 +609,25 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -636,14 +640,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -657,35 +661,35 @@ public void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -703,23 +707,23 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -731,14 +735,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -755,22 +759,22 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -781,14 +785,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -800,22 +804,22 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -826,7 +830,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java index 8be3f3d781..d75cc6f096 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java @@ -53,19 +53,19 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class IdentityClientHttpJsonTest { +class IdentityClientHttpJsonTest { private static MockHttpService mockService; private static IdentityClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -81,21 +81,21 @@ public static void startStaticServer() throws IOException { client = IdentityClient.create(settings); } - @AfterClass + @AfterAll public static void stopServer() { client.close(); } - @Before - public void setUp() {} + @BeforeEach + void setUp() {} - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { mockService.reset(); } @Test - public void createUserTest() throws Exception { + void createUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -114,10 +114,10 @@ public void createUserTest() throws Exception { String email = "email96619420"; User actualResponse = client.createUser(displayName, email); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -125,14 +125,14 @@ public void createUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createUserExceptionTest() throws Exception { + void createUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -142,14 +142,14 @@ public void createUserExceptionTest() throws Exception { String displayName = "displayName1714148973"; String email = "email96619420"; client.createUser(displayName, email); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createUserTest2() throws Exception { + void createUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -173,10 +173,10 @@ public void createUserTest2() throws Exception { User actualResponse = client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -184,14 +184,14 @@ public void createUserTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createUserExceptionTest2() throws Exception { + void createUserExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -205,14 +205,14 @@ public void createUserExceptionTest2() throws Exception { boolean enableNotifications = true; double heightFeet = -1032737338; client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getUserTest() throws Exception { + void getUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -230,10 +230,10 @@ public void getUserTest() throws Exception { UserName name = UserName.of("[USER]"); User actualResponse = client.getUser(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -241,14 +241,14 @@ public void getUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getUserExceptionTest() throws Exception { + void getUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -257,14 +257,14 @@ public void getUserExceptionTest() throws Exception { try { UserName name = UserName.of("[USER]"); client.getUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getUserTest2() throws Exception { + void getUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -282,10 +282,10 @@ public void getUserTest2() throws Exception { String name = "users/user-6376"; User actualResponse = client.getUser(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -293,14 +293,14 @@ public void getUserTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getUserExceptionTest2() throws Exception { + void getUserExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -309,14 +309,14 @@ public void getUserExceptionTest2() throws Exception { try { String name = "users/user-6376"; client.getUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void updateUserTest() throws Exception { + void updateUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -349,10 +349,10 @@ public void updateUserTest() throws Exception { .build(); User actualResponse = client.updateUser(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -360,14 +360,14 @@ public void updateUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void updateUserExceptionTest() throws Exception { + void updateUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -391,14 +391,14 @@ public void updateUserExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateUser(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteUserTest() throws Exception { + void deleteUserTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -407,7 +407,7 @@ public void deleteUserTest() throws Exception { client.deleteUser(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -415,14 +415,14 @@ public void deleteUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteUserExceptionTest() throws Exception { + void deleteUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -431,14 +431,14 @@ public void deleteUserExceptionTest() throws Exception { try { UserName name = UserName.of("[USER]"); client.deleteUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteUserTest2() throws Exception { + void deleteUserTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -447,7 +447,7 @@ public void deleteUserTest2() throws Exception { client.deleteUser(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -455,14 +455,14 @@ public void deleteUserTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteUserExceptionTest2() throws Exception { + void deleteUserExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -471,14 +471,14 @@ public void deleteUserExceptionTest2() throws Exception { try { String name = "users/user-6376"; client.deleteUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listUsersTest() throws Exception { + void listUsersTest() throws Exception { User responsesElement = User.newBuilder().build(); ListUsersResponse expectedResponse = ListUsersResponse.newBuilder() @@ -497,11 +497,11 @@ public void listUsersTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -509,14 +509,14 @@ public void listUsersTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listUsersExceptionTest() throws Exception { + void listUsersExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -529,14 +529,14 @@ public void listUsersExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listUsers(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -557,11 +557,11 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -569,14 +569,14 @@ public void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -591,14 +591,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -615,10 +615,10 @@ public void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -626,14 +626,14 @@ public void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -645,14 +645,14 @@ public void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -670,10 +670,10 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -681,14 +681,14 @@ public void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -702,14 +702,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -726,10 +726,10 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -737,14 +737,14 @@ public void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -757,14 +757,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -776,10 +776,10 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -787,14 +787,14 @@ public void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -807,7 +807,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java index bba5e80d12..5804d2034a 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java @@ -53,15 +53,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class IdentityClientTest { +class IdentityClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockIdentity mockIdentity; private static MockLocations mockLocations; @@ -69,7 +69,7 @@ public class IdentityClientTest { private LocalChannelProvider channelProvider; private IdentityClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() { mockIdentity = new MockIdentity(); mockLocations = new MockLocations(); @@ -81,13 +81,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterClass + @AfterAll public static void stopServer() { mockServiceHelper.stop(); } - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); IdentitySettings settings = @@ -98,13 +98,13 @@ public void setUp() throws IOException { client = IdentityClient.create(settings); } - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { client.close(); } @Test - public void createUserTest() throws Exception { + void createUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -123,22 +123,22 @@ public void createUserTest() throws Exception { String email = "email96619420"; User actualResponse = client.createUser(displayName, email); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateUserRequest actualRequest = ((CreateUserRequest) actualRequests.get(0)); - Assert.assertEquals(displayName, actualRequest.getUser().getDisplayName()); - Assert.assertEquals(email, actualRequest.getUser().getEmail()); - Assert.assertTrue( + Assertions.assertEquals(displayName, actualRequest.getUser().getDisplayName()); + Assertions.assertEquals(email, actualRequest.getUser().getEmail()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createUserExceptionTest() throws Exception { + void createUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -146,14 +146,14 @@ public void createUserExceptionTest() throws Exception { String displayName = "displayName1714148973"; String email = "email96619420"; client.createUser(displayName, email); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createUserTest2() throws Exception { + void createUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -177,26 +177,26 @@ public void createUserTest2() throws Exception { User actualResponse = client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateUserRequest actualRequest = ((CreateUserRequest) actualRequests.get(0)); - Assert.assertEquals(displayName, actualRequest.getUser().getDisplayName()); - Assert.assertEquals(email, actualRequest.getUser().getEmail()); - Assert.assertEquals(age, actualRequest.getUser().getAge()); - Assert.assertEquals(nickname, actualRequest.getUser().getNickname()); - Assert.assertEquals(enableNotifications, actualRequest.getUser().getEnableNotifications()); - Assert.assertEquals(heightFeet, actualRequest.getUser().getHeightFeet(), 0.0001); - Assert.assertTrue( + Assertions.assertEquals(displayName, actualRequest.getUser().getDisplayName()); + Assertions.assertEquals(email, actualRequest.getUser().getEmail()); + Assertions.assertEquals(age, actualRequest.getUser().getAge()); + Assertions.assertEquals(nickname, actualRequest.getUser().getNickname()); + Assertions.assertEquals(enableNotifications, actualRequest.getUser().getEnableNotifications()); + Assertions.assertEquals(heightFeet, actualRequest.getUser().getHeightFeet(), 0.0001); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createUserExceptionTest2() throws Exception { + void createUserExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -208,14 +208,14 @@ public void createUserExceptionTest2() throws Exception { boolean enableNotifications = true; double heightFeet = -1032737338; client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getUserTest() throws Exception { + void getUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -233,35 +233,35 @@ public void getUserTest() throws Exception { UserName name = UserName.of("[USER]"); User actualResponse = client.getUser(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetUserRequest actualRequest = ((GetUserRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getUserExceptionTest() throws Exception { + void getUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { UserName name = UserName.of("[USER]"); client.getUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getUserTest2() throws Exception { + void getUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -279,35 +279,35 @@ public void getUserTest2() throws Exception { String name = "name3373707"; User actualResponse = client.getUser(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetUserRequest actualRequest = ((GetUserRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getUserExceptionTest2() throws Exception { + void getUserExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { String name = "name3373707"; client.getUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void updateUserTest() throws Exception { + void updateUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -329,22 +329,22 @@ public void updateUserTest() throws Exception { .build(); User actualResponse = client.updateUser(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); UpdateUserRequest actualRequest = ((UpdateUserRequest) actualRequests.get(0)); - Assert.assertEquals(request.getUser(), actualRequest.getUser()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getUser(), actualRequest.getUser()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void updateUserExceptionTest() throws Exception { + void updateUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -355,14 +355,14 @@ public void updateUserExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateUser(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteUserTest() throws Exception { + void deleteUserTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockIdentity.addResponse(expectedResponse); @@ -371,32 +371,32 @@ public void deleteUserTest() throws Exception { client.deleteUser(name); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteUserRequest actualRequest = ((DeleteUserRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteUserExceptionTest() throws Exception { + void deleteUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { UserName name = UserName.of("[USER]"); client.deleteUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteUserTest2() throws Exception { + void deleteUserTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockIdentity.addResponse(expectedResponse); @@ -405,32 +405,32 @@ public void deleteUserTest2() throws Exception { client.deleteUser(name); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteUserRequest actualRequest = ((DeleteUserRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteUserExceptionTest2() throws Exception { + void deleteUserExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { String name = "name3373707"; client.deleteUser(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listUsersTest() throws Exception { + void listUsersTest() throws Exception { User responsesElement = User.newBuilder().build(); ListUsersResponse expectedResponse = ListUsersResponse.newBuilder() @@ -449,23 +449,23 @@ public void listUsersTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); List actualRequests = mockIdentity.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListUsersRequest actualRequest = ((ListUsersRequest) actualRequests.get(0)); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listUsersExceptionTest() throws Exception { + void listUsersExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -476,14 +476,14 @@ public void listUsersExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listUsers(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -504,25 +504,25 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -535,14 +535,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -556,35 +556,35 @@ public void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -602,23 +602,23 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -630,14 +630,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -654,22 +654,22 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -680,14 +680,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -699,22 +699,22 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -725,7 +725,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java index f943d18786..4f92c398df 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java @@ -56,19 +56,19 @@ import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class MessagingClientHttpJsonTest { +class MessagingClientHttpJsonTest { private static MockHttpService mockService; private static MessagingClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -84,21 +84,21 @@ public static void startStaticServer() throws IOException { client = MessagingClient.create(settings); } - @AfterClass + @AfterAll public static void stopServer() { client.close(); } - @Before - public void setUp() {} + @BeforeEach + void setUp() {} - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { mockService.reset(); } @Test - public void createRoomTest() throws Exception { + void createRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -113,10 +113,10 @@ public void createRoomTest() throws Exception { String description = "description-1724546052"; Room actualResponse = client.createRoom(displayName, description); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -124,14 +124,14 @@ public void createRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createRoomExceptionTest() throws Exception { + void createRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -141,14 +141,14 @@ public void createRoomExceptionTest() throws Exception { String displayName = "displayName1714148973"; String description = "description-1724546052"; client.createRoom(displayName, description); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getRoomTest() throws Exception { + void getRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -162,10 +162,10 @@ public void getRoomTest() throws Exception { RoomName name = RoomName.of("[ROOM]"); Room actualResponse = client.getRoom(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -173,14 +173,14 @@ public void getRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getRoomExceptionTest() throws Exception { + void getRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -189,14 +189,14 @@ public void getRoomExceptionTest() throws Exception { try { RoomName name = RoomName.of("[ROOM]"); client.getRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getRoomTest2() throws Exception { + void getRoomTest2() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -210,10 +210,10 @@ public void getRoomTest2() throws Exception { String name = "rooms/room-472"; Room actualResponse = client.getRoom(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -221,14 +221,14 @@ public void getRoomTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getRoomExceptionTest2() throws Exception { + void getRoomExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -237,14 +237,14 @@ public void getRoomExceptionTest2() throws Exception { try { String name = "rooms/room-472"; client.getRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void updateRoomTest() throws Exception { + void updateRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -269,10 +269,10 @@ public void updateRoomTest() throws Exception { .build(); Room actualResponse = client.updateRoom(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -280,14 +280,14 @@ public void updateRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void updateRoomExceptionTest() throws Exception { + void updateRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -307,14 +307,14 @@ public void updateRoomExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateRoom(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteRoomTest() throws Exception { + void deleteRoomTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -323,7 +323,7 @@ public void deleteRoomTest() throws Exception { client.deleteRoom(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -331,14 +331,14 @@ public void deleteRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteRoomExceptionTest() throws Exception { + void deleteRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -347,14 +347,14 @@ public void deleteRoomExceptionTest() throws Exception { try { RoomName name = RoomName.of("[ROOM]"); client.deleteRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteRoomTest2() throws Exception { + void deleteRoomTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -363,7 +363,7 @@ public void deleteRoomTest2() throws Exception { client.deleteRoom(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -371,14 +371,14 @@ public void deleteRoomTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteRoomExceptionTest2() throws Exception { + void deleteRoomExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -387,14 +387,14 @@ public void deleteRoomExceptionTest2() throws Exception { try { String name = "rooms/room-472"; client.deleteRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listRoomsTest() throws Exception { + void listRoomsTest() throws Exception { Room responsesElement = Room.newBuilder().build(); ListRoomsResponse expectedResponse = ListRoomsResponse.newBuilder() @@ -413,11 +413,11 @@ public void listRoomsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -425,14 +425,14 @@ public void listRoomsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listRoomsExceptionTest() throws Exception { + void listRoomsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -445,14 +445,14 @@ public void listRoomsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listRooms(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest() throws Exception { + void createBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -469,10 +469,10 @@ public void createBlurbTest() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -480,14 +480,14 @@ public void createBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest() throws Exception { + void createBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -498,14 +498,14 @@ public void createBlurbExceptionTest() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest2() throws Exception { + void createBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -522,10 +522,10 @@ public void createBlurbTest2() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -533,14 +533,14 @@ public void createBlurbTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest2() throws Exception { + void createBlurbExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -551,14 +551,14 @@ public void createBlurbExceptionTest2() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest3() throws Exception { + void createBlurbTest3() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -575,10 +575,10 @@ public void createBlurbTest3() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -586,14 +586,14 @@ public void createBlurbTest3() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest3() throws Exception { + void createBlurbExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -604,14 +604,14 @@ public void createBlurbExceptionTest3() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest4() throws Exception { + void createBlurbTest4() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -628,10 +628,10 @@ public void createBlurbTest4() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -639,14 +639,14 @@ public void createBlurbTest4() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest4() throws Exception { + void createBlurbExceptionTest4() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -657,14 +657,14 @@ public void createBlurbExceptionTest4() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest5() throws Exception { + void createBlurbTest5() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -681,10 +681,10 @@ public void createBlurbTest5() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -692,14 +692,14 @@ public void createBlurbTest5() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest5() throws Exception { + void createBlurbExceptionTest5() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -710,14 +710,14 @@ public void createBlurbExceptionTest5() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest6() throws Exception { + void createBlurbTest6() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -734,10 +734,10 @@ public void createBlurbTest6() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -745,14 +745,14 @@ public void createBlurbTest6() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest6() throws Exception { + void createBlurbExceptionTest6() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -763,14 +763,14 @@ public void createBlurbExceptionTest6() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest7() throws Exception { + void createBlurbTest7() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -787,10 +787,10 @@ public void createBlurbTest7() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -798,14 +798,14 @@ public void createBlurbTest7() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest7() throws Exception { + void createBlurbExceptionTest7() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -816,14 +816,14 @@ public void createBlurbExceptionTest7() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest8() throws Exception { + void createBlurbTest8() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -840,10 +840,10 @@ public void createBlurbTest8() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -851,14 +851,14 @@ public void createBlurbTest8() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest8() throws Exception { + void createBlurbExceptionTest8() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -869,14 +869,14 @@ public void createBlurbExceptionTest8() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest9() throws Exception { + void createBlurbTest9() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -893,10 +893,10 @@ public void createBlurbTest9() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -904,14 +904,14 @@ public void createBlurbTest9() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest9() throws Exception { + void createBlurbExceptionTest9() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -922,14 +922,14 @@ public void createBlurbExceptionTest9() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest10() throws Exception { + void createBlurbTest10() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -946,10 +946,10 @@ public void createBlurbTest10() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -957,14 +957,14 @@ public void createBlurbTest10() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest10() throws Exception { + void createBlurbExceptionTest10() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -975,14 +975,14 @@ public void createBlurbExceptionTest10() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest11() throws Exception { + void createBlurbTest11() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -999,10 +999,10 @@ public void createBlurbTest11() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1010,14 +1010,14 @@ public void createBlurbTest11() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest11() throws Exception { + void createBlurbExceptionTest11() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1028,14 +1028,14 @@ public void createBlurbExceptionTest11() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest12() throws Exception { + void createBlurbTest12() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -1052,10 +1052,10 @@ public void createBlurbTest12() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1063,14 +1063,14 @@ public void createBlurbTest12() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createBlurbExceptionTest12() throws Exception { + void createBlurbExceptionTest12() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1081,14 +1081,14 @@ public void createBlurbExceptionTest12() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getBlurbTest() throws Exception { + void getBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1101,10 +1101,10 @@ public void getBlurbTest() throws Exception { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); Blurb actualResponse = client.getBlurb(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1112,14 +1112,14 @@ public void getBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getBlurbExceptionTest() throws Exception { + void getBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1128,14 +1128,14 @@ public void getBlurbExceptionTest() throws Exception { try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.getBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getBlurbTest2() throws Exception { + void getBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1148,10 +1148,10 @@ public void getBlurbTest2() throws Exception { String name = "rooms/room-9094/blurbs/blurb-9094"; Blurb actualResponse = client.getBlurb(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1159,14 +1159,14 @@ public void getBlurbTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getBlurbExceptionTest2() throws Exception { + void getBlurbExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1175,14 +1175,14 @@ public void getBlurbExceptionTest2() throws Exception { try { String name = "rooms/room-9094/blurbs/blurb-9094"; client.getBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void updateBlurbTest() throws Exception { + void updateBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1205,10 +1205,10 @@ public void updateBlurbTest() throws Exception { .build(); Blurb actualResponse = client.updateBlurb(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1216,14 +1216,14 @@ public void updateBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void updateBlurbExceptionTest() throws Exception { + void updateBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1242,14 +1242,14 @@ public void updateBlurbExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateBlurb(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteBlurbTest() throws Exception { + void deleteBlurbTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -1258,7 +1258,7 @@ public void deleteBlurbTest() throws Exception { client.deleteBlurb(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1266,14 +1266,14 @@ public void deleteBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteBlurbExceptionTest() throws Exception { + void deleteBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1282,14 +1282,14 @@ public void deleteBlurbExceptionTest() throws Exception { try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.deleteBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteBlurbTest2() throws Exception { + void deleteBlurbTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -1298,7 +1298,7 @@ public void deleteBlurbTest2() throws Exception { client.deleteBlurb(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1306,14 +1306,14 @@ public void deleteBlurbTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteBlurbExceptionTest2() throws Exception { + void deleteBlurbExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1322,14 +1322,14 @@ public void deleteBlurbExceptionTest2() throws Exception { try { String name = "rooms/room-9094/blurbs/blurb-9094"; client.deleteBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listBlurbsTest() throws Exception { + void listBlurbsTest() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1344,11 +1344,11 @@ public void listBlurbsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1356,14 +1356,14 @@ public void listBlurbsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listBlurbsExceptionTest() throws Exception { + void listBlurbsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1372,14 +1372,14 @@ public void listBlurbsExceptionTest() throws Exception { try { ProfileName parent = ProfileName.of("[USER]"); client.listBlurbs(parent); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listBlurbsTest2() throws Exception { + void listBlurbsTest2() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1394,11 +1394,11 @@ public void listBlurbsTest2() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1406,14 +1406,14 @@ public void listBlurbsTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listBlurbsExceptionTest2() throws Exception { + void listBlurbsExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1422,14 +1422,14 @@ public void listBlurbsExceptionTest2() throws Exception { try { RoomName parent = RoomName.of("[ROOM]"); client.listBlurbs(parent); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listBlurbsTest3() throws Exception { + void listBlurbsTest3() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1444,11 +1444,11 @@ public void listBlurbsTest3() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1456,14 +1456,14 @@ public void listBlurbsTest3() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listBlurbsExceptionTest3() throws Exception { + void listBlurbsExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1472,14 +1472,14 @@ public void listBlurbsExceptionTest3() throws Exception { try { String parent = "rooms/room-4889"; client.listBlurbs(parent); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void searchBlurbsTest() throws Exception { + void searchBlurbsTest() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1497,10 +1497,10 @@ public void searchBlurbsTest() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1508,14 +1508,14 @@ public void searchBlurbsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void searchBlurbsExceptionTest() throws Exception { + void searchBlurbsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1525,13 +1525,13 @@ public void searchBlurbsExceptionTest() throws Exception { ProfileName parent = ProfileName.of("[USER]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - public void searchBlurbsTest2() throws Exception { + void searchBlurbsTest2() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1549,10 +1549,10 @@ public void searchBlurbsTest2() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1560,14 +1560,14 @@ public void searchBlurbsTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void searchBlurbsExceptionTest2() throws Exception { + void searchBlurbsExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1577,13 +1577,13 @@ public void searchBlurbsExceptionTest2() throws Exception { RoomName parent = RoomName.of("[ROOM]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - public void searchBlurbsTest3() throws Exception { + void searchBlurbsTest3() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1601,10 +1601,10 @@ public void searchBlurbsTest3() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1612,14 +1612,14 @@ public void searchBlurbsTest3() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void searchBlurbsExceptionTest3() throws Exception { + void searchBlurbsExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1629,16 +1629,16 @@ public void searchBlurbsExceptionTest3() throws Exception { String parent = "rooms/room-4889"; String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - public void streamBlurbsTest() throws Exception {} + void streamBlurbsTest() throws Exception {} @Test - public void streamBlurbsExceptionTest() throws Exception { + void streamBlurbsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1646,19 +1646,19 @@ public void streamBlurbsExceptionTest() throws Exception { } @Test - public void sendBlurbsUnsupportedMethodTest() throws Exception { + void sendBlurbsUnsupportedMethodTest() throws Exception { // The sendBlurbs() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - public void connectUnsupportedMethodTest() throws Exception { + void connectUnsupportedMethodTest() throws Exception { // The connect() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -1679,11 +1679,11 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1691,14 +1691,14 @@ public void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1713,14 +1713,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -1737,10 +1737,10 @@ public void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1748,14 +1748,14 @@ public void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1767,14 +1767,14 @@ public void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1792,10 +1792,10 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1803,14 +1803,14 @@ public void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1824,14 +1824,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1848,10 +1848,10 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1859,14 +1859,14 @@ public void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1879,14 +1879,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -1898,10 +1898,10 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1909,14 +1909,14 @@ public void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1929,7 +1929,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java index aba31f54f9..273a8e1f61 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java @@ -62,15 +62,15 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class MessagingClientTest { +class MessagingClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; private static MockMessaging mockMessaging; @@ -78,7 +78,7 @@ public class MessagingClientTest { private LocalChannelProvider channelProvider; private MessagingClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() { mockMessaging = new MockMessaging(); mockLocations = new MockLocations(); @@ -90,13 +90,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterClass + @AfterAll public static void stopServer() { mockServiceHelper.stop(); } - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); MessagingSettings settings = @@ -107,13 +107,13 @@ public void setUp() throws IOException { client = MessagingClient.create(settings); } - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { client.close(); } @Test - public void createRoomTest() throws Exception { + void createRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -128,22 +128,22 @@ public void createRoomTest() throws Exception { String description = "description-1724546052"; Room actualResponse = client.createRoom(displayName, description); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateRoomRequest actualRequest = ((CreateRoomRequest) actualRequests.get(0)); - Assert.assertEquals(displayName, actualRequest.getRoom().getDisplayName()); - Assert.assertEquals(description, actualRequest.getRoom().getDescription()); - Assert.assertTrue( + Assertions.assertEquals(displayName, actualRequest.getRoom().getDisplayName()); + Assertions.assertEquals(description, actualRequest.getRoom().getDescription()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createRoomExceptionTest() throws Exception { + void createRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -151,14 +151,14 @@ public void createRoomExceptionTest() throws Exception { String displayName = "displayName1714148973"; String description = "description-1724546052"; client.createRoom(displayName, description); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getRoomTest() throws Exception { + void getRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -172,35 +172,35 @@ public void getRoomTest() throws Exception { RoomName name = RoomName.of("[ROOM]"); Room actualResponse = client.getRoom(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetRoomRequest actualRequest = ((GetRoomRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getRoomExceptionTest() throws Exception { + void getRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { RoomName name = RoomName.of("[ROOM]"); client.getRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getRoomTest2() throws Exception { + void getRoomTest2() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -214,35 +214,35 @@ public void getRoomTest2() throws Exception { String name = "name3373707"; Room actualResponse = client.getRoom(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetRoomRequest actualRequest = ((GetRoomRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getRoomExceptionTest2() throws Exception { + void getRoomExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.getRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void updateRoomTest() throws Exception { + void updateRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -260,22 +260,22 @@ public void updateRoomTest() throws Exception { .build(); Room actualResponse = client.updateRoom(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); UpdateRoomRequest actualRequest = ((UpdateRoomRequest) actualRequests.get(0)); - Assert.assertEquals(request.getRoom(), actualRequest.getRoom()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getRoom(), actualRequest.getRoom()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void updateRoomExceptionTest() throws Exception { + void updateRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -286,14 +286,14 @@ public void updateRoomExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateRoom(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteRoomTest() throws Exception { + void deleteRoomTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -302,32 +302,32 @@ public void deleteRoomTest() throws Exception { client.deleteRoom(name); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteRoomRequest actualRequest = ((DeleteRoomRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteRoomExceptionTest() throws Exception { + void deleteRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { RoomName name = RoomName.of("[ROOM]"); client.deleteRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteRoomTest2() throws Exception { + void deleteRoomTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -336,32 +336,32 @@ public void deleteRoomTest2() throws Exception { client.deleteRoom(name); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteRoomRequest actualRequest = ((DeleteRoomRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteRoomExceptionTest2() throws Exception { + void deleteRoomExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.deleteRoom(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listRoomsTest() throws Exception { + void listRoomsTest() throws Exception { Room responsesElement = Room.newBuilder().build(); ListRoomsResponse expectedResponse = ListRoomsResponse.newBuilder() @@ -380,23 +380,23 @@ public void listRoomsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListRoomsRequest actualRequest = ((ListRoomsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listRoomsExceptionTest() throws Exception { + void listRoomsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -407,14 +407,14 @@ public void listRoomsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listRooms(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest() throws Exception { + void createBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -431,23 +431,23 @@ public void createBlurbTest() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assert.assertEquals(image, actualRequest.getBlurb().getImage()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest() throws Exception { + void createBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -456,14 +456,14 @@ public void createBlurbExceptionTest() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest2() throws Exception { + void createBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -480,23 +480,23 @@ public void createBlurbTest2() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assert.assertEquals(text, actualRequest.getBlurb().getText()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assertions.assertEquals(text, actualRequest.getBlurb().getText()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest2() throws Exception { + void createBlurbExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -505,14 +505,14 @@ public void createBlurbExceptionTest2() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest3() throws Exception { + void createBlurbTest3() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -529,23 +529,23 @@ public void createBlurbTest3() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user, actualRequest.getBlurb().getUser()); - Assert.assertEquals(image, actualRequest.getBlurb().getImage()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); + Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest3() throws Exception { + void createBlurbExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -554,14 +554,14 @@ public void createBlurbExceptionTest3() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest4() throws Exception { + void createBlurbTest4() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -578,23 +578,23 @@ public void createBlurbTest4() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user, actualRequest.getBlurb().getUser()); - Assert.assertEquals(text, actualRequest.getBlurb().getText()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); + Assertions.assertEquals(text, actualRequest.getBlurb().getText()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest4() throws Exception { + void createBlurbExceptionTest4() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -603,14 +603,14 @@ public void createBlurbExceptionTest4() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest5() throws Exception { + void createBlurbTest5() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -627,23 +627,23 @@ public void createBlurbTest5() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assert.assertEquals(image, actualRequest.getBlurb().getImage()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest5() throws Exception { + void createBlurbExceptionTest5() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -652,14 +652,14 @@ public void createBlurbExceptionTest5() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest6() throws Exception { + void createBlurbTest6() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -676,23 +676,23 @@ public void createBlurbTest6() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assert.assertEquals(text, actualRequest.getBlurb().getText()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assertions.assertEquals(text, actualRequest.getBlurb().getText()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest6() throws Exception { + void createBlurbExceptionTest6() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -701,14 +701,14 @@ public void createBlurbExceptionTest6() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest7() throws Exception { + void createBlurbTest7() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -725,23 +725,23 @@ public void createBlurbTest7() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user, actualRequest.getBlurb().getUser()); - Assert.assertEquals(image, actualRequest.getBlurb().getImage()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); + Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest7() throws Exception { + void createBlurbExceptionTest7() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -750,14 +750,14 @@ public void createBlurbExceptionTest7() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest8() throws Exception { + void createBlurbTest8() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -774,23 +774,23 @@ public void createBlurbTest8() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(user, actualRequest.getBlurb().getUser()); - Assert.assertEquals(text, actualRequest.getBlurb().getText()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); + Assertions.assertEquals(text, actualRequest.getBlurb().getText()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest8() throws Exception { + void createBlurbExceptionTest8() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -799,14 +799,14 @@ public void createBlurbExceptionTest8() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest9() throws Exception { + void createBlurbTest9() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -823,23 +823,23 @@ public void createBlurbTest9() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assert.assertEquals(image, actualRequest.getBlurb().getImage()); - Assert.assertTrue( + Assertions.assertEquals(parent, actualRequest.getParent()); + Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest9() throws Exception { + void createBlurbExceptionTest9() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -848,14 +848,14 @@ public void createBlurbExceptionTest9() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest10() throws Exception { + void createBlurbTest10() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -872,23 +872,23 @@ public void createBlurbTest10() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assert.assertEquals(text, actualRequest.getBlurb().getText()); - Assert.assertTrue( + Assertions.assertEquals(parent, actualRequest.getParent()); + Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assertions.assertEquals(text, actualRequest.getBlurb().getText()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest10() throws Exception { + void createBlurbExceptionTest10() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -897,14 +897,14 @@ public void createBlurbExceptionTest10() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest11() throws Exception { + void createBlurbTest11() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -921,23 +921,23 @@ public void createBlurbTest11() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(user, actualRequest.getBlurb().getUser()); - Assert.assertEquals(image, actualRequest.getBlurb().getImage()); - Assert.assertTrue( + Assertions.assertEquals(parent, actualRequest.getParent()); + Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); + Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest11() throws Exception { + void createBlurbExceptionTest11() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -946,14 +946,14 @@ public void createBlurbExceptionTest11() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createBlurbTest12() throws Exception { + void createBlurbTest12() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -970,23 +970,23 @@ public void createBlurbTest12() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(user, actualRequest.getBlurb().getUser()); - Assert.assertEquals(text, actualRequest.getBlurb().getText()); - Assert.assertTrue( + Assertions.assertEquals(parent, actualRequest.getParent()); + Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); + Assertions.assertEquals(text, actualRequest.getBlurb().getText()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createBlurbExceptionTest12() throws Exception { + void createBlurbExceptionTest12() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -995,14 +995,14 @@ public void createBlurbExceptionTest12() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getBlurbTest() throws Exception { + void getBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1015,35 +1015,35 @@ public void getBlurbTest() throws Exception { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); Blurb actualResponse = client.getBlurb(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetBlurbRequest actualRequest = ((GetBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getBlurbExceptionTest() throws Exception { + void getBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.getBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getBlurbTest2() throws Exception { + void getBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1056,35 +1056,35 @@ public void getBlurbTest2() throws Exception { String name = "name3373707"; Blurb actualResponse = client.getBlurb(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetBlurbRequest actualRequest = ((GetBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getBlurbExceptionTest2() throws Exception { + void getBlurbExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.getBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void updateBlurbTest() throws Exception { + void updateBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1101,22 +1101,22 @@ public void updateBlurbTest() throws Exception { .build(); Blurb actualResponse = client.updateBlurb(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); UpdateBlurbRequest actualRequest = ((UpdateBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(request.getBlurb(), actualRequest.getBlurb()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getBlurb(), actualRequest.getBlurb()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void updateBlurbExceptionTest() throws Exception { + void updateBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1127,14 +1127,14 @@ public void updateBlurbExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateBlurb(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteBlurbTest() throws Exception { + void deleteBlurbTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -1143,32 +1143,32 @@ public void deleteBlurbTest() throws Exception { client.deleteBlurb(name); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteBlurbRequest actualRequest = ((DeleteBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteBlurbExceptionTest() throws Exception { + void deleteBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.deleteBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteBlurbTest2() throws Exception { + void deleteBlurbTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -1177,32 +1177,32 @@ public void deleteBlurbTest2() throws Exception { client.deleteBlurb(name); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteBlurbRequest actualRequest = ((DeleteBlurbRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteBlurbExceptionTest2() throws Exception { + void deleteBlurbExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.deleteBlurb(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listBlurbsTest() throws Exception { + void listBlurbsTest() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1217,36 +1217,36 @@ public void listBlurbsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListBlurbsRequest actualRequest = ((ListBlurbsRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listBlurbsExceptionTest() throws Exception { + void listBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { ProfileName parent = ProfileName.of("[USER]"); client.listBlurbs(parent); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listBlurbsTest2() throws Exception { + void listBlurbsTest2() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1261,36 +1261,36 @@ public void listBlurbsTest2() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListBlurbsRequest actualRequest = ((ListBlurbsRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listBlurbsExceptionTest2() throws Exception { + void listBlurbsExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { RoomName parent = RoomName.of("[ROOM]"); client.listBlurbs(parent); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listBlurbsTest3() throws Exception { + void listBlurbsTest3() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1305,36 +1305,36 @@ public void listBlurbsTest3() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListBlurbsRequest actualRequest = ((ListBlurbsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertTrue( + Assertions.assertEquals(parent, actualRequest.getParent()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listBlurbsExceptionTest3() throws Exception { + void listBlurbsExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String parent = "parent-995424086"; client.listBlurbs(parent); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void searchBlurbsTest() throws Exception { + void searchBlurbsTest() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1352,22 +1352,22 @@ public void searchBlurbsTest() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SearchBlurbsRequest actualRequest = ((SearchBlurbsRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(query, actualRequest.getQuery()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(query, actualRequest.getQuery()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void searchBlurbsExceptionTest() throws Exception { + void searchBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1375,16 +1375,17 @@ public void searchBlurbsExceptionTest() throws Exception { ProfileName parent = ProfileName.of("[USER]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void searchBlurbsTest2() throws Exception { + void searchBlurbsTest2() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1402,22 +1403,22 @@ public void searchBlurbsTest2() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SearchBlurbsRequest actualRequest = ((SearchBlurbsRequest) actualRequests.get(0)); - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(query, actualRequest.getQuery()); - Assert.assertTrue( + Assertions.assertEquals(parent.toString(), actualRequest.getParent()); + Assertions.assertEquals(query, actualRequest.getQuery()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void searchBlurbsExceptionTest2() throws Exception { + void searchBlurbsExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1425,16 +1426,17 @@ public void searchBlurbsExceptionTest2() throws Exception { RoomName parent = RoomName.of("[ROOM]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void searchBlurbsTest3() throws Exception { + void searchBlurbsTest3() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1452,22 +1454,22 @@ public void searchBlurbsTest3() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SearchBlurbsRequest actualRequest = ((SearchBlurbsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(query, actualRequest.getQuery()); - Assert.assertTrue( + Assertions.assertEquals(parent, actualRequest.getParent()); + Assertions.assertEquals(query, actualRequest.getQuery()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void searchBlurbsExceptionTest3() throws Exception { + void searchBlurbsExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1475,16 +1477,17 @@ public void searchBlurbsExceptionTest3() throws Exception { String parent = "parent-995424086"; String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void streamBlurbsTest() throws Exception { + void streamBlurbsTest() throws Exception { StreamBlurbsResponse expectedResponse = StreamBlurbsResponse.newBuilder().setBlurb(Blurb.newBuilder().build()).build(); mockMessaging.addResponse(expectedResponse); @@ -1501,12 +1504,12 @@ public void streamBlurbsTest() throws Exception { callable.serverStreamingCall(request, responseObserver); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void streamBlurbsExceptionTest() throws Exception { + void streamBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); StreamBlurbsRequest request = @@ -1523,16 +1526,17 @@ public void streamBlurbsExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void sendBlurbsTest() throws Exception { + void sendBlurbsTest() throws Exception { SendBlurbsResponse expectedResponse = SendBlurbsResponse.newBuilder().addAllNames(new ArrayList()).build(); mockMessaging.addResponse(expectedResponse); @@ -1553,12 +1557,12 @@ public void sendBlurbsTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void sendBlurbsExceptionTest() throws Exception { + void sendBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); CreateBlurbRequest request = @@ -1578,16 +1582,17 @@ public void sendBlurbsExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void connectTest() throws Exception { + void connectTest() throws Exception { StreamBlurbsResponse expectedResponse = StreamBlurbsResponse.newBuilder().setBlurb(Blurb.newBuilder().build()).build(); mockMessaging.addResponse(expectedResponse); @@ -1603,12 +1608,12 @@ public void connectTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void connectExceptionTest() throws Exception { + void connectExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); ConnectRequest request = ConnectRequest.newBuilder().build(); @@ -1623,16 +1628,17 @@ public void connectExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -1653,25 +1659,25 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -1684,14 +1690,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -1705,35 +1711,35 @@ public void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1751,23 +1757,23 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1779,14 +1785,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1803,22 +1809,22 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1829,14 +1835,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -1848,22 +1854,22 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1874,7 +1880,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java index e95fda6114..7a1c5eedd0 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java @@ -51,19 +51,19 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class SequenceServiceClientHttpJsonTest { +class SequenceServiceClientHttpJsonTest { private static MockHttpService mockService; private static SequenceServiceClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -80,21 +80,21 @@ public static void startStaticServer() throws IOException { client = SequenceServiceClient.create(settings); } - @AfterClass + @AfterAll public static void stopServer() { client.close(); } - @Before - public void setUp() {} + @BeforeEach + void setUp() {} - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { mockService.reset(); } @Test - public void createSequenceTest() throws Exception { + void createSequenceTest() throws Exception { Sequence expectedResponse = Sequence.newBuilder() .setName(SequenceName.of("[SEQUENCE]").toString()) @@ -105,10 +105,10 @@ public void createSequenceTest() throws Exception { Sequence sequence = Sequence.newBuilder().build(); Sequence actualResponse = client.createSequence(sequence); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -116,14 +116,14 @@ public void createSequenceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createSequenceExceptionTest() throws Exception { + void createSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -132,14 +132,14 @@ public void createSequenceExceptionTest() throws Exception { try { Sequence sequence = Sequence.newBuilder().build(); client.createSequence(sequence); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createStreamingSequenceTest() throws Exception { + void createStreamingSequenceTest() throws Exception { StreamingSequence expectedResponse = StreamingSequence.newBuilder() .setName(StreamingSequenceName.of("[STREAMING_SEQUENCE]").toString()) @@ -151,10 +151,10 @@ public void createStreamingSequenceTest() throws Exception { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); StreamingSequence actualResponse = client.createStreamingSequence(streamingSequence); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -162,14 +162,14 @@ public void createStreamingSequenceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createStreamingSequenceExceptionTest() throws Exception { + void createStreamingSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -178,14 +178,14 @@ public void createStreamingSequenceExceptionTest() throws Exception { try { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); client.createStreamingSequence(streamingSequence); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getSequenceReportTest() throws Exception { + void getSequenceReportTest() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -196,10 +196,10 @@ public void getSequenceReportTest() throws Exception { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); SequenceReport actualResponse = client.getSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -207,14 +207,14 @@ public void getSequenceReportTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getSequenceReportExceptionTest() throws Exception { + void getSequenceReportExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -223,14 +223,14 @@ public void getSequenceReportExceptionTest() throws Exception { try { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); client.getSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getSequenceReportTest2() throws Exception { + void getSequenceReportTest2() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -241,10 +241,10 @@ public void getSequenceReportTest2() throws Exception { String name = "sequences/sequence-5566/sequenceReport"; SequenceReport actualResponse = client.getSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -252,14 +252,14 @@ public void getSequenceReportTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getSequenceReportExceptionTest2() throws Exception { + void getSequenceReportExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -268,14 +268,14 @@ public void getSequenceReportExceptionTest2() throws Exception { try { String name = "sequences/sequence-5566/sequenceReport"; client.getSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getStreamingSequenceReportTest() throws Exception { + void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -286,10 +286,10 @@ public void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -297,14 +297,14 @@ public void getStreamingSequenceReportTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getStreamingSequenceReportExceptionTest() throws Exception { + void getStreamingSequenceReportExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -313,14 +313,14 @@ public void getStreamingSequenceReportExceptionTest() throws Exception { try { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); client.getStreamingSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getStreamingSequenceReportTest2() throws Exception { + void getStreamingSequenceReportTest2() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -331,10 +331,10 @@ public void getStreamingSequenceReportTest2() throws Exception { String name = "streamingSequences/streamingSequence-962/streamingSequenceReport"; StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -342,14 +342,14 @@ public void getStreamingSequenceReportTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getStreamingSequenceReportExceptionTest2() throws Exception { + void getStreamingSequenceReportExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -358,14 +358,14 @@ public void getStreamingSequenceReportExceptionTest2() throws Exception { try { String name = "streamingSequences/streamingSequence-962/streamingSequenceReport"; client.getStreamingSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void attemptSequenceTest() throws Exception { + void attemptSequenceTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -374,7 +374,7 @@ public void attemptSequenceTest() throws Exception { client.attemptSequence(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -382,14 +382,14 @@ public void attemptSequenceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void attemptSequenceExceptionTest() throws Exception { + void attemptSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -398,14 +398,14 @@ public void attemptSequenceExceptionTest() throws Exception { try { SequenceName name = SequenceName.of("[SEQUENCE]"); client.attemptSequence(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void attemptSequenceTest2() throws Exception { + void attemptSequenceTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -414,7 +414,7 @@ public void attemptSequenceTest2() throws Exception { client.attemptSequence(name); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -422,14 +422,14 @@ public void attemptSequenceTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void attemptSequenceExceptionTest2() throws Exception { + void attemptSequenceExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -438,17 +438,17 @@ public void attemptSequenceExceptionTest2() throws Exception { try { String name = "sequences/sequence-9950"; client.attemptSequence(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void attemptStreamingSequenceTest() throws Exception {} + void attemptStreamingSequenceTest() throws Exception {} @Test - public void attemptStreamingSequenceExceptionTest() throws Exception { + void attemptStreamingSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -456,7 +456,7 @@ public void attemptStreamingSequenceExceptionTest() throws Exception { } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -477,11 +477,11 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -489,14 +489,14 @@ public void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -511,14 +511,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -535,10 +535,10 @@ public void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -546,14 +546,14 @@ public void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -565,14 +565,14 @@ public void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -590,10 +590,10 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -601,14 +601,14 @@ public void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -622,14 +622,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -646,10 +646,10 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -657,14 +657,14 @@ public void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -677,14 +677,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -696,10 +696,10 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -707,14 +707,14 @@ public void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -727,7 +727,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java index bd5b067014..7c2a612715 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java @@ -55,15 +55,15 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class SequenceServiceClientTest { +class SequenceServiceClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; private static MockSequenceService mockSequenceService; @@ -71,7 +71,7 @@ public class SequenceServiceClientTest { private LocalChannelProvider channelProvider; private SequenceServiceClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() { mockSequenceService = new MockSequenceService(); mockLocations = new MockLocations(); @@ -83,13 +83,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterClass + @AfterAll public static void stopServer() { mockServiceHelper.stop(); } - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); SequenceServiceSettings settings = @@ -100,13 +100,13 @@ public void setUp() throws IOException { client = SequenceServiceClient.create(settings); } - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { client.close(); } @Test - public void createSequenceTest() throws Exception { + void createSequenceTest() throws Exception { Sequence expectedResponse = Sequence.newBuilder() .setName(SequenceName.of("[SEQUENCE]").toString()) @@ -117,35 +117,35 @@ public void createSequenceTest() throws Exception { Sequence sequence = Sequence.newBuilder().build(); Sequence actualResponse = client.createSequence(sequence); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateSequenceRequest actualRequest = ((CreateSequenceRequest) actualRequests.get(0)); - Assert.assertEquals(sequence, actualRequest.getSequence()); - Assert.assertTrue( + Assertions.assertEquals(sequence, actualRequest.getSequence()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createSequenceExceptionTest() throws Exception { + void createSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { Sequence sequence = Sequence.newBuilder().build(); client.createSequence(sequence); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void createStreamingSequenceTest() throws Exception { + void createStreamingSequenceTest() throws Exception { StreamingSequence expectedResponse = StreamingSequence.newBuilder() .setName(StreamingSequenceName.of("[STREAMING_SEQUENCE]").toString()) @@ -157,36 +157,36 @@ public void createStreamingSequenceTest() throws Exception { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); StreamingSequence actualResponse = client.createStreamingSequence(streamingSequence); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateStreamingSequenceRequest actualRequest = ((CreateStreamingSequenceRequest) actualRequests.get(0)); - Assert.assertEquals(streamingSequence, actualRequest.getStreamingSequence()); - Assert.assertTrue( + Assertions.assertEquals(streamingSequence, actualRequest.getStreamingSequence()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createStreamingSequenceExceptionTest() throws Exception { + void createStreamingSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); client.createStreamingSequence(streamingSequence); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getSequenceReportTest() throws Exception { + void getSequenceReportTest() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -197,35 +197,35 @@ public void getSequenceReportTest() throws Exception { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); SequenceReport actualResponse = client.getSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetSequenceReportRequest actualRequest = ((GetSequenceReportRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getSequenceReportExceptionTest() throws Exception { + void getSequenceReportExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); client.getSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getSequenceReportTest2() throws Exception { + void getSequenceReportTest2() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -236,35 +236,35 @@ public void getSequenceReportTest2() throws Exception { String name = "name3373707"; SequenceReport actualResponse = client.getSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetSequenceReportRequest actualRequest = ((GetSequenceReportRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getSequenceReportExceptionTest2() throws Exception { + void getSequenceReportExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { String name = "name3373707"; client.getSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getStreamingSequenceReportTest() throws Exception { + void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -275,36 +275,36 @@ public void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetStreamingSequenceReportRequest actualRequest = ((GetStreamingSequenceReportRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getStreamingSequenceReportExceptionTest() throws Exception { + void getStreamingSequenceReportExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); client.getStreamingSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getStreamingSequenceReportTest2() throws Exception { + void getStreamingSequenceReportTest2() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -315,36 +315,36 @@ public void getStreamingSequenceReportTest2() throws Exception { String name = "name3373707"; StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetStreamingSequenceReportRequest actualRequest = ((GetStreamingSequenceReportRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getStreamingSequenceReportExceptionTest2() throws Exception { + void getStreamingSequenceReportExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { String name = "name3373707"; client.getStreamingSequenceReport(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void attemptSequenceTest() throws Exception { + void attemptSequenceTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSequenceService.addResponse(expectedResponse); @@ -353,32 +353,32 @@ public void attemptSequenceTest() throws Exception { client.attemptSequence(name); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); AttemptSequenceRequest actualRequest = ((AttemptSequenceRequest) actualRequests.get(0)); - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name.toString(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void attemptSequenceExceptionTest() throws Exception { + void attemptSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { SequenceName name = SequenceName.of("[SEQUENCE]"); client.attemptSequence(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void attemptSequenceTest2() throws Exception { + void attemptSequenceTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSequenceService.addResponse(expectedResponse); @@ -387,32 +387,32 @@ public void attemptSequenceTest2() throws Exception { client.attemptSequence(name); List actualRequests = mockSequenceService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); AttemptSequenceRequest actualRequest = ((AttemptSequenceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(name, actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void attemptSequenceExceptionTest2() throws Exception { + void attemptSequenceExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { String name = "name3373707"; client.attemptSequence(name); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void attemptStreamingSequenceTest() throws Exception { + void attemptStreamingSequenceTest() throws Exception { AttemptStreamingSequenceResponse expectedResponse = AttemptStreamingSequenceResponse.newBuilder().setContent("content951530617").build(); mockSequenceService.addResponse(expectedResponse); @@ -429,12 +429,12 @@ public void attemptStreamingSequenceTest() throws Exception { callable.serverStreamingCall(request, responseObserver); List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); + Assertions.assertEquals(1, actualResponses.size()); + Assertions.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - public void attemptStreamingSequenceExceptionTest() throws Exception { + void attemptStreamingSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); AttemptStreamingSequenceRequest request = @@ -451,16 +451,17 @@ public void attemptStreamingSequenceExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); + Assertions.fail("No exception thrown"); } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assertions.assertEquals( + StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -481,25 +482,25 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -512,14 +513,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -533,35 +534,35 @@ public void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -579,23 +580,23 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -607,14 +608,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -631,22 +632,22 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -657,14 +658,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -676,22 +677,22 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -702,7 +703,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java index 9c49a43893..ae339c8171 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java @@ -53,19 +53,19 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class TestingClientHttpJsonTest { +class TestingClientHttpJsonTest { private static MockHttpService mockService; private static TestingClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -81,21 +81,21 @@ public static void startStaticServer() throws IOException { client = TestingClient.create(settings); } - @AfterClass + @AfterAll public static void stopServer() { client.close(); } - @Before - public void setUp() {} + @BeforeEach + void setUp() {} - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { mockService.reset(); } @Test - public void createSessionTest() throws Exception { + void createSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockService.addResponse(expectedResponse); @@ -104,10 +104,10 @@ public void createSessionTest() throws Exception { CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); Session actualResponse = client.createSession(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -115,14 +115,14 @@ public void createSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void createSessionExceptionTest() throws Exception { + void createSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -132,14 +132,14 @@ public void createSessionExceptionTest() throws Exception { CreateSessionRequest request = CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); client.createSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getSessionTest() throws Exception { + void getSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockService.addResponse(expectedResponse); @@ -148,10 +148,10 @@ public void getSessionTest() throws Exception { GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); Session actualResponse = client.getSession(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -159,14 +159,14 @@ public void getSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getSessionExceptionTest() throws Exception { + void getSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -176,14 +176,14 @@ public void getSessionExceptionTest() throws Exception { GetSessionRequest request = GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.getSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listSessionsTest() throws Exception { + void listSessionsTest() throws Exception { Session responsesElement = Session.newBuilder().build(); ListSessionsResponse expectedResponse = ListSessionsResponse.newBuilder() @@ -202,11 +202,11 @@ public void listSessionsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -214,14 +214,14 @@ public void listSessionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listSessionsExceptionTest() throws Exception { + void listSessionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -234,14 +234,14 @@ public void listSessionsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listSessions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteSessionTest() throws Exception { + void deleteSessionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -251,7 +251,7 @@ public void deleteSessionTest() throws Exception { client.deleteSession(request); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -259,14 +259,14 @@ public void deleteSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteSessionExceptionTest() throws Exception { + void deleteSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -276,14 +276,14 @@ public void deleteSessionExceptionTest() throws Exception { DeleteSessionRequest request = DeleteSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.deleteSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void reportSessionTest() throws Exception { + void reportSessionTest() throws Exception { ReportSessionResponse expectedResponse = ReportSessionResponse.newBuilder().addAllTestRuns(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -292,10 +292,10 @@ public void reportSessionTest() throws Exception { ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); ReportSessionResponse actualResponse = client.reportSession(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -303,14 +303,14 @@ public void reportSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void reportSessionExceptionTest() throws Exception { + void reportSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -320,14 +320,14 @@ public void reportSessionExceptionTest() throws Exception { ReportSessionRequest request = ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.reportSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listTestsTest() throws Exception { + void listTestsTest() throws Exception { com.google.showcase.v1beta1.Test responsesElement = com.google.showcase.v1beta1.Test.newBuilder().build(); ListTestsResponse expectedResponse = @@ -349,11 +349,11 @@ public void listTestsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -361,14 +361,14 @@ public void listTestsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listTestsExceptionTest() throws Exception { + void listTestsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -382,14 +382,14 @@ public void listTestsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listTests(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteTestTest() throws Exception { + void deleteTestTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -401,7 +401,7 @@ public void deleteTestTest() throws Exception { client.deleteTest(request); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -409,14 +409,14 @@ public void deleteTestTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void deleteTestExceptionTest() throws Exception { + void deleteTestExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -428,14 +428,14 @@ public void deleteTestExceptionTest() throws Exception { .setName(TestName.of("[SESSION]", "[TEST]").toString()) .build(); client.deleteTest(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void verifyTestTest() throws Exception { + void verifyTestTest() throws Exception { VerifyTestResponse expectedResponse = VerifyTestResponse.newBuilder().setIssue(Issue.newBuilder().build()).build(); mockService.addResponse(expectedResponse); @@ -448,10 +448,10 @@ public void verifyTestTest() throws Exception { .build(); VerifyTestResponse actualResponse = client.verifyTest(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -459,14 +459,14 @@ public void verifyTestTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void verifyTestExceptionTest() throws Exception { + void verifyTestExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -480,14 +480,14 @@ public void verifyTestExceptionTest() throws Exception { .addAllAnswers(new ArrayList()) .build(); client.verifyTest(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -508,11 +508,11 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -520,14 +520,14 @@ public void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -542,14 +542,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -566,10 +566,10 @@ public void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -577,14 +577,14 @@ public void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -596,14 +596,14 @@ public void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -621,10 +621,10 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -632,14 +632,14 @@ public void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -653,14 +653,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -677,10 +677,10 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -688,14 +688,14 @@ public void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -708,14 +708,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -727,10 +727,10 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -738,14 +738,14 @@ public void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assert.assertTrue( + Assertions.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -758,7 +758,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java index 81ca82c304..dd29bd26d4 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java @@ -53,15 +53,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; @Generated("by gapic-generator-java") -public class TestingClientTest { +class TestingClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; @@ -69,7 +69,7 @@ public class TestingClientTest { private LocalChannelProvider channelProvider; private TestingClient client; - @BeforeClass + @BeforeAll public static void startStaticServer() { mockTesting = new MockTesting(); mockLocations = new MockLocations(); @@ -81,13 +81,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterClass + @AfterAll public static void stopServer() { mockServiceHelper.stop(); } - @Before - public void setUp() throws IOException { + @BeforeEach + void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); TestingSettings settings = @@ -98,13 +98,13 @@ public void setUp() throws IOException { client = TestingClient.create(settings); } - @After - public void tearDown() throws Exception { + @AfterEach + void tearDown() throws Exception { client.close(); } @Test - public void createSessionTest() throws Exception { + void createSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockTesting.addResponse(expectedResponse); @@ -113,21 +113,21 @@ public void createSessionTest() throws Exception { CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); Session actualResponse = client.createSession(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); CreateSessionRequest actualRequest = ((CreateSessionRequest) actualRequests.get(0)); - Assert.assertEquals(request.getSession(), actualRequest.getSession()); - Assert.assertTrue( + Assertions.assertEquals(request.getSession(), actualRequest.getSession()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void createSessionExceptionTest() throws Exception { + void createSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -135,14 +135,14 @@ public void createSessionExceptionTest() throws Exception { CreateSessionRequest request = CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); client.createSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getSessionTest() throws Exception { + void getSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockTesting.addResponse(expectedResponse); @@ -151,21 +151,21 @@ public void getSessionTest() throws Exception { GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); Session actualResponse = client.getSession(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetSessionRequest actualRequest = ((GetSessionRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getSessionExceptionTest() throws Exception { + void getSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -173,14 +173,14 @@ public void getSessionExceptionTest() throws Exception { GetSessionRequest request = GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.getSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listSessionsTest() throws Exception { + void listSessionsTest() throws Exception { Session responsesElement = Session.newBuilder().build(); ListSessionsResponse expectedResponse = ListSessionsResponse.newBuilder() @@ -199,23 +199,23 @@ public void listSessionsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListSessionsRequest actualRequest = ((ListSessionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listSessionsExceptionTest() throws Exception { + void listSessionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -226,14 +226,14 @@ public void listSessionsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listSessions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteSessionTest() throws Exception { + void deleteSessionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTesting.addResponse(expectedResponse); @@ -243,18 +243,18 @@ public void deleteSessionTest() throws Exception { client.deleteSession(request); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteSessionRequest actualRequest = ((DeleteSessionRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteSessionExceptionTest() throws Exception { + void deleteSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -262,14 +262,14 @@ public void deleteSessionExceptionTest() throws Exception { DeleteSessionRequest request = DeleteSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.deleteSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void reportSessionTest() throws Exception { + void reportSessionTest() throws Exception { ReportSessionResponse expectedResponse = ReportSessionResponse.newBuilder().addAllTestRuns(new ArrayList()).build(); mockTesting.addResponse(expectedResponse); @@ -278,21 +278,21 @@ public void reportSessionTest() throws Exception { ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); ReportSessionResponse actualResponse = client.reportSession(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ReportSessionRequest actualRequest = ((ReportSessionRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void reportSessionExceptionTest() throws Exception { + void reportSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -300,14 +300,14 @@ public void reportSessionExceptionTest() throws Exception { ReportSessionRequest request = ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.reportSession(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listTestsTest() throws Exception { + void listTestsTest() throws Exception { com.google.showcase.v1beta1.Test responsesElement = com.google.showcase.v1beta1.Test.newBuilder().build(); ListTestsResponse expectedResponse = @@ -329,24 +329,24 @@ public void listTestsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListTestsRequest actualRequest = ((ListTestsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getParent(), actualRequest.getParent()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getParent(), actualRequest.getParent()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listTestsExceptionTest() throws Exception { + void listTestsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -358,14 +358,14 @@ public void listTestsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listTests(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void deleteTestTest() throws Exception { + void deleteTestTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTesting.addResponse(expectedResponse); @@ -377,18 +377,18 @@ public void deleteTestTest() throws Exception { client.deleteTest(request); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); DeleteTestRequest actualRequest = ((DeleteTestRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void deleteTestExceptionTest() throws Exception { + void deleteTestExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -398,14 +398,14 @@ public void deleteTestExceptionTest() throws Exception { .setName(TestName.of("[SESSION]", "[TEST]").toString()) .build(); client.deleteTest(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void verifyTestTest() throws Exception { + void verifyTestTest() throws Exception { VerifyTestResponse expectedResponse = VerifyTestResponse.newBuilder().setIssue(Issue.newBuilder().build()).build(); mockTesting.addResponse(expectedResponse); @@ -418,23 +418,23 @@ public void verifyTestTest() throws Exception { .build(); VerifyTestResponse actualResponse = client.verifyTest(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); VerifyTestRequest actualRequest = ((VerifyTestRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getAnswer(), actualRequest.getAnswer()); - Assert.assertEquals(request.getAnswersList(), actualRequest.getAnswersList()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getAnswer(), actualRequest.getAnswer()); + Assertions.assertEquals(request.getAnswersList(), actualRequest.getAnswersList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void verifyTestExceptionTest() throws Exception { + void verifyTestExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -446,14 +446,14 @@ public void verifyTestExceptionTest() throws Exception { .addAllAnswers(new ArrayList()) .build(); client.verifyTest(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void listLocationsTest() throws Exception { + void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -474,25 +474,25 @@ public void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assertions.assertEquals(1, resources.size()); + Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void listLocationsExceptionTest() throws Exception { + void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -505,14 +505,14 @@ public void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getLocationTest() throws Exception { + void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -526,35 +526,35 @@ public void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( + Assertions.assertEquals(request.getName(), actualRequest.getName()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getLocationExceptionTest() throws Exception { + void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void setIamPolicyTest() throws Exception { + void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -572,23 +572,23 @@ public void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void setIamPolicyExceptionTest() throws Exception { + void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -600,14 +600,14 @@ public void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void getIamPolicyTest() throws Exception { + void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -624,22 +624,22 @@ public void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void getIamPolicyExceptionTest() throws Exception { + void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -650,14 +650,14 @@ public void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - public void testIamPermissionsTest() throws Exception { + void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -669,22 +669,22 @@ public void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assert.assertEquals(expectedResponse, actualResponse); + Assertions.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assert.assertEquals(1, actualRequests.size()); + Assertions.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(request.getResource(), actualRequest.getResource()); - Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assert.assertTrue( + Assertions.assertEquals(request.getResource(), actualRequest.getResource()); + Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assertions.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - public void testIamPermissionsExceptionTest() throws Exception { + void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -695,7 +695,7 @@ public void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assert.fail("No exception raised"); + Assertions.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } From 29b369beca730873781427cc0ebffc5acda39eff Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 05:53:18 +0000 Subject: [PATCH 03/17] migrated it tests. --- showcase/gapic-showcase/pom.xml | 5 +++ .../v1beta1/it/ITAutoPopulatedFields.java | 12 +++--- .../showcase/v1beta1/it/ITBidiStreaming.java | 12 +++--- .../showcase/v1beta1/it/ITClientShutdown.java | 23 +++++++---- .../v1beta1/it/ITClientSideStreaming.java | 12 +++--- .../v1beta1/it/ITCommonServiceMixins.java | 12 +++--- .../google/showcase/v1beta1/it/ITCrud.java | 16 ++++---- .../v1beta1/it/ITDynamicRoutingHeaders.java | 12 +++--- .../v1beta1/it/ITEndpointContext.java | 8 ++-- .../google/showcase/v1beta1/it/ITGdch.java | 16 ++++---- .../showcase/v1beta1/it/ITHttpAnnotation.java | 40 +++++++++---------- .../com/google/showcase/v1beta1/it/ITIam.java | 16 ++++---- .../v1beta1/it/ITLongRunningOperation.java | 4 +- .../showcase/v1beta1/it/ITNumericEnums.java | 14 +++---- .../showcase/v1beta1/it/ITOtelMetrics.java | 30 +++++++------- .../showcase/v1beta1/it/ITPagination.java | 12 +++--- .../v1beta1/it/ITServerSideStreaming.java | 20 +++++----- .../showcase/v1beta1/it/ITUnaryCallable.java | 12 +++--- .../showcase/v1beta1/it/ITUnaryDeadline.java | 4 +- 19 files changed, 144 insertions(+), 136 deletions(-) diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index b30297f5eb..784abd5829 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -152,6 +152,11 @@ junit-vintage-engine test + + org.junit.jupiter + junit-jupiter-params + test + com.google.truth truth diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java index d448a2af8b..d954e99a7e 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java @@ -47,12 +47,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -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; import org.threeten.bp.Duration; -public class ITAutoPopulatedFields { +class ITAutoPopulatedFields { private static class HttpJsonInterceptor implements HttpJsonClientInterceptor { private Consumer onRequestIntercepted; @@ -120,7 +120,7 @@ public void sendMessage(ReqT message) { private EchoClient httpJsonClient; private EchoClient httpJsonClientWithRetries; - @Before + @BeforeEach public void createClients() throws Exception { RetrySettings defaultRetrySettings = RetrySettings.newBuilder() @@ -156,7 +156,7 @@ public void createClients() throws Exception { defaultRetrySettings, retryableCodes, ImmutableList.of(httpJsonInterceptor)); } - @After + @AfterEach public void destroyClient() { grpcClientWithoutRetries.close(); grpcClientWithRetries.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java index 4a2717b6f3..0a47592e7b 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java @@ -30,21 +30,21 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -public class ITBidiStreaming { +class ITBidiStreaming { private static EchoClient grpcClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws Exception { grpcClient.close(); grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java index 5915c8e065..2e384139a7 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java @@ -24,30 +24,34 @@ import com.google.showcase.v1beta1.EchoClient; import com.google.showcase.v1beta1.EchoRequest; import com.google.showcase.v1beta1.it.util.TestClientInitializer; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.threeten.bp.Duration; -public class ITClientShutdown { +class ITClientShutdown { private static final long DEFAULT_RPC_TIMEOUT_MS = 15000L; private static final long DEFAULT_CLIENT_TERMINATION_MS = 5000L; // Test to ensure the client can close + terminate properly - @Test(timeout = 15000L) + @Test + @Timeout(15) public void testGrpc_closeClient() throws Exception { EchoClient grpcClient = TestClientInitializer.createGrpcEchoClient(); assertClientTerminated(grpcClient); } // Test to ensure the client can close + terminate properly - @Test(timeout = 15000L) + @Test + @Timeout(15) public void testHttpJson_closeClient() throws Exception { EchoClient httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); assertClientTerminated(httpjsonClient); } // Test to ensure the client can close + terminate after a quick RPC invocation - @Test(timeout = 15000L) + @Test + @Timeout(15) public void testGrpc_rpcInvoked_closeClient() throws Exception { EchoClient grpcClient = TestClientInitializer.createGrpcEchoClient(); // Response is ignored for this test @@ -56,7 +60,8 @@ public void testGrpc_rpcInvoked_closeClient() throws Exception { } // Test to ensure the client can close + terminate after a quick RPC invocation - @Test(timeout = 15000L) + @Test + @Timeout(15) public void testHttpJson_rpcInvoked_closeClient() throws Exception { EchoClient httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); // Response is ignored for this test @@ -67,7 +72,8 @@ public void testHttpJson_rpcInvoked_closeClient() throws Exception { // This test is to ensure that the client is able to close + terminate any resources // once a response has been received. Set a max test duration of 15s to ensure that // the test does not continue on forever. - @Test(timeout = 15000L) + @Test + @Timeout(15) public void testGrpc_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived() throws Exception { // Set the maxAttempts to 1 to ensure there are no retries scheduled. The single RPC @@ -100,7 +106,8 @@ public void testGrpc_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived( // This test is to ensure that the client is able to close + terminate any resources // once a response has been received. Set a max test duration of 15s to ensure that // the test does not continue on forever. - @Test(timeout = 15000L) + @Test + @Timeout(15) public void testHttpJson_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived() throws Exception { // Set the maxAttempts to 1 to ensure there are no retries scheduled. The single RPC diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java index d6a25654e4..a047abb242 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java @@ -32,21 +32,21 @@ import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -public class ITClientSideStreaming { +class ITClientSideStreaming { private static EchoClient grpcClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java index a00809914a..12bb2db890 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java @@ -27,11 +27,11 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -public class ITCommonServiceMixins { +class ITCommonServiceMixins { // The showcase server always returns a fixed list of locations. See // https://github.com/googleapis/gapic-showcase/blob/main/server/services/locations_service.go @@ -56,7 +56,7 @@ public class ITCommonServiceMixins { private static EchoClient grpcClient; private static EchoClient httpjsonClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); @@ -65,7 +65,7 @@ public static void createClients() throws Exception { httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java index 3cf4b77d2f..de44cc4889 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java @@ -30,12 +30,12 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class ITCrud { +class ITCrud { private static final User DEFAULT_USER = User.newBuilder() @@ -49,7 +49,7 @@ public class ITCrud { private static IdentityClient grpcClient; private static IdentityClient httpjsonClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC IdentityClient grpcClient = TestClientInitializer.createGrpcIdentityClient(); @@ -57,7 +57,7 @@ public static void createClients() throws Exception { httpjsonClient = TestClientInitializer.createHttpJsonIdentityClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); @@ -67,7 +67,7 @@ public static void destroyClients() throws InterruptedException { TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } - @Before + @BeforeEach public void cleanupData() { IdentityClient.ListUsersPagedResponse pagedResponse = grpcClient.listUsers(ListUsersRequest.newBuilder().setPageSize(5).build()); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java index bafe8730d0..bfa8f5ea1c 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java @@ -45,11 +45,11 @@ import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -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 ITDynamicRoutingHeaders { +class ITDynamicRoutingHeaders { private static final String SPLIT_TOKEN = "&"; private static final Metadata.Key REQUEST_PARAMS_HEADER_KEY = Metadata.Key.of(DYNAMIC_ROUTING_HEADER_KEY, Metadata.ASCII_STRING_MARSHALLER); @@ -127,7 +127,7 @@ public void onClose(int statusCode, HttpJsonMetadata trailers) { private ComplianceClient grpcComplianceClient; private ComplianceClient httpJsonComplianceClient; - @Before + @BeforeEach public void createClients() throws Exception { // Create gRPC Interceptor and Client grpcInterceptor = new GrpcCapturingClientInterceptor(); @@ -153,7 +153,7 @@ public void createClients() throws Exception { TestClientInitializer.createHttpJsonEchoClient(ImmutableList.of(httpJsonInterceptor)); } - @After + @AfterEach public void destroyClient() throws InterruptedException { grpcClient.close(); grpcComplianceClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java index 812a52696b..4c81887e42 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java @@ -22,8 +22,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; /** * This IT tests the different user configurations allowed and their effects on endpoint and @@ -38,7 +38,7 @@ * only use the gRPC transport for testing. HttpJson functionality exists inside the wrapper * classes, but is not being used. */ -public class ITEndpointContext { +class ITEndpointContext { /** * Inside the test cases below, we must explicitly configure serviceName. Normally this should not * be configured at all, but showcase clients do not have a serviceName. The ExtendStubSettings @@ -221,7 +221,7 @@ public Credentials getCredentials() { private EchoClient echoClient; - @After + @AfterEach public void cleanup() throws InterruptedException { if (echoClient != null) { echoClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java index ed5ff03100..d359ff5cf4 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java @@ -18,10 +18,10 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; 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.assertTrue; import com.google.api.client.json.GenericJson; import com.google.api.client.json.JsonFactory; @@ -45,17 +45,17 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.concurrent.TimeUnit; -import org.junit.After; -import org.junit.Before; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.rules.TemporaryFolder; /** * Test suite to confirm a client can be instantiated with GDCH credentials. No calls are made since * it is not feasible to test against real GDCH servers (or replicate an environment) */ -public class ITGdch { +class ITGdch { private static final String CA_CERT_FILENAME = "fake_cert.pem"; private static final String CA_CERT_RESOURCE_PATH = "/" + CA_CERT_FILENAME; @@ -76,7 +76,7 @@ public class ITGdch { private String projectId; private URI tokenUri; - @Before + @BeforeEach public void setup() throws IOException, URISyntaxException { transportFactory = new InterceptingMockTokenServerTransportFactory(); prepareCredentials(); @@ -86,7 +86,7 @@ public void setup() throws IOException, URISyntaxException { .build(); } - @After + @AfterEach public void tearDown() throws InterruptedException { if (client != null) { client.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java index d81b142918..a16af1cba5 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java @@ -39,37 +39,32 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.stream.Collectors; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import java.util.stream.Stream; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; // This test runs from the parameters in the compliance_suite.json file // The file is downloaded from the gapic-showcase repo. Each compliance // group is a set of HttpJson behaviors we want to test for. Each group // tests the product of the rpc list and requests list. -@RunWith(Parameterized.class) -public class ITHttpAnnotation { +class ITHttpAnnotation { - @Parameterized.Parameters(name = "Compliance Group Name: {0}") - public static String[] data() { - return new String[] { - "Fully working conversions, resources", - "Binding selection testing", - "Cases that apply to non-path requests", - "Fully working conversions, no resources" - }; + public static Stream data() { + return Stream.of( + Arguments.of("Fully working conversions, resources"), + Arguments.of("Binding selection testing"), + Arguments.of("Cases that apply to non-path requests"), + Arguments.of("Fully working conversions, no resources")); } - @Parameterized.Parameter(0) - public String groupName; - private static ComplianceClient httpjsonClient; private static ComplianceSuite complianceSuite; private static Map> validComplianceRpcMap; - @BeforeClass + @BeforeAll public static void createClients() throws IOException, GeneralSecurityException { ComplianceSuite.Builder builder = ComplianceSuite.newBuilder(); JsonFormat.parser() @@ -113,7 +108,7 @@ public static void createClients() throws IOException, GeneralSecurityException httpjsonClient::repeatDataPathResource); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { httpjsonClient.close(); httpjsonClient.awaitTermination( @@ -123,8 +118,9 @@ public static void destroyClients() throws InterruptedException { // Verify that the input's info is the same as the response's info // This ensures that the entire group's behavior over HttpJson // works as intended - @Test - public void testComplianceGroup() { + @ParameterizedTest + @MethodSource("data") + public void testComplianceGroup(String groupName) { Optional complianceGroupOptional = complianceSuite.getGroupList().stream() .filter(x -> x.getName().equals(groupName)) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java index 181608571a..4aacfa2057 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java @@ -31,12 +31,12 @@ import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -public class ITIam { +class ITIam { private static final Policy DEFAULT_POLICY = Policy.newBuilder() .addBindings(Binding.newBuilder().setRole("foo.editor").addMembers("allUsers")) @@ -45,18 +45,18 @@ public class ITIam { private static IdentityClient httpjsonClient; private String resourceName; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { grpcClient = TestClientInitializer.createGrpcIdentityClient(); httpjsonClient = TestClientInitializer.createHttpJsonIdentityClient(); } - @Before + @BeforeEach public void setupTests() { resourceName = "users/" + UUID.randomUUID().toString().substring(0, 8); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java index 5f1e29963d..d01d1df012 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java @@ -28,7 +28,7 @@ import com.google.showcase.v1beta1.it.util.TestClientInitializer; import java.util.concurrent.CancellationException; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.threeten.bp.Duration; import org.threeten.bp.Instant; import org.threeten.bp.temporal.ChronoUnit; @@ -37,7 +37,7 @@ * For this test, we test a combination of various LRO RetrySettings and try to ensure that the * calls are polling correctly. Each test attempts to test the number of attempts done in each call. */ -public class ITLongRunningOperation { +class ITLongRunningOperation { @Test public void testGRPC_LROSuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java index 2b921b421b..187a560cd0 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java @@ -16,7 +16,7 @@ package com.google.showcase.v1beta1.it; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.gax.core.NoCredentialsProvider; @@ -28,15 +28,15 @@ import java.io.IOException; import java.security.GeneralSecurityException; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -public class ITNumericEnums { +class ITNumericEnums { private static ComplianceClient httpjsonClient; - @BeforeClass + @BeforeAll public static void createClients() throws GeneralSecurityException, IOException { ComplianceSettings complianceSettings = ComplianceSettings.newHttpJsonBuilder() @@ -51,7 +51,7 @@ public static void createClients() throws GeneralSecurityException, IOException httpjsonClient = ComplianceClient.create(complianceSettings); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { httpjsonClient.close(); httpjsonClient.awaitTermination( diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java index 317897710b..dcdffa5818 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java @@ -76,11 +76,11 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** * Showcase Test to confirm that metrics are being collected and that the correct metrics are being @@ -93,7 +93,7 @@ * via {@link #verifyStatusAttribute(List, List)}. Finally, check that the status for each attempt * is correct. */ -public class ITOtelMetrics { +class ITOtelMetrics { private static final int DEFAULT_OPERATION_COUNT = 1; private static final String SERVICE_NAME = "ShowcaseTest"; private static final String ATTEMPT_COUNT = SERVICE_NAME + "/attempt_count"; @@ -141,7 +141,7 @@ private OpenTelemetryMetricsRecorder createOtelMetricsRecorder( return new OpenTelemetryMetricsRecorder(openTelemetry, SERVICE_NAME); } - @Before + @BeforeEach public void setup() throws Exception { inMemoryMetricReader = InMemoryMetricReader.create(); OpenTelemetryMetricsRecorder otelMetricsRecorder = @@ -154,7 +154,7 @@ public void setup() throws Exception { new MetricsTracerFactory(otelMetricsRecorder)); } - @After + @AfterEach public void cleanup() throws InterruptedException { inMemoryMetricReader.shutdown(); @@ -285,7 +285,7 @@ private List getMetricDataList() throws InterruptedException { return metricData; } } - Assert.fail("Unable to collect all the metrics required for the test"); + Assertions.fail("Unable to collect all the metrics required for the test"); return new ArrayList<>(); } @@ -311,7 +311,7 @@ public void testGrpc_operationSucceeded_recordsMetrics() throws InterruptedExcep verifyStatusAttribute(metricDataList, statusCountList); } - @Ignore("https://github.com/googleapis/sdk-platform-java/issues/2503") + @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test public void testHttpJson_operationSucceeded_recordsMetrics() throws InterruptedException { int attemptCount = 1; @@ -364,7 +364,7 @@ public void testGrpc_operationCancelled_recordsMetrics() throws Exception { verifyStatusAttribute(metricDataList, statusCountList); } - @Ignore("https://github.com/googleapis/sdk-platform-java/issues/2503") + @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test public void testHttpJson_operationCancelled_recordsMetrics() throws Exception { int attemptCount = 1; @@ -421,7 +421,7 @@ public void testGrpc_operationFailed_recordsMetrics() throws InterruptedExceptio verifyStatusAttribute(metricDataList, statusCountList); } - @Ignore("https://github.com/googleapis/sdk-platform-java/issues/2503") + @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test public void testHttpJson_operationFailed_recordsMetrics() throws InterruptedException { int attemptCount = 1; @@ -517,7 +517,7 @@ public void testGrpc_attemptFailedRetriesExhausted_recordsMetrics() throws Excep grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } - @Ignore("https://github.com/googleapis/sdk-platform-java/issues/2503") + @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test public void testHttpJson_attemptFailedRetriesExhausted_recordsMetrics() throws Exception { int attemptCount = 3; @@ -612,7 +612,7 @@ public void testGrpc_attemptPermanentFailure_recordsMetrics() throws Interrupted verifyStatusAttribute(metricDataList, statusCountList); } - @Ignore("https://github.com/googleapis/sdk-platform-java/issues/2503") + @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test public void testHttpJson_attemptPermanentFailure_recordsMetrics() throws InterruptedException { int attemptCount = 1; @@ -713,7 +713,7 @@ public void testGrpc_multipleFailedAttempts_successfulOperation() throws Excepti grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } - @Ignore("https://github.com/googleapis/sdk-platform-java/issues/2503") + @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test public void testHttpJson_multipleFailedAttempts_successfulOperation() throws Exception { int attemptCount = 3; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java index 4d4aaf3002..73dc14fbfc 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java @@ -23,16 +23,16 @@ import com.google.showcase.v1beta1.PagedExpandRequest; import com.google.showcase.v1beta1.it.util.TestClientInitializer; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -public class ITPagination { +class ITPagination { private static EchoClient grpcClient; private static EchoClient httpjsonClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); @@ -40,7 +40,7 @@ public static void createClients() throws Exception { httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java index 9558be2e9d..fd9ab96ce5 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java @@ -36,19 +36,19 @@ import java.util.Iterator; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.threeten.bp.Duration; -public class ITServerSideStreaming { +class ITServerSideStreaming { private static EchoClient grpcClient; private static EchoClient httpjsonClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); @@ -56,7 +56,7 @@ public static void createClients() throws Exception { httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); @@ -151,7 +151,7 @@ public void testGrpc_serverWaitTimeout_watchdogCancelsStream() throws Exception for (EchoResponse response : responseStream) { responses.add(response.getContent()); } - Assert.fail("No exception was thrown"); + Assertions.fail("No exception was thrown"); } catch (WatchdogTimeoutException e) { assertThat(e).hasMessageThat().contains("Canceled due to timeout waiting for next response"); } finally { @@ -178,7 +178,7 @@ public void testHttpJson_receiveStreamedContent() { .inOrder(); } - @Ignore( + @Disabled( value = "Ignore until https://github.com/googleapis/gapic-showcase/issues/1286 is resolved") @Test public void testHttpJson_serverError_receiveErrorAfterLastWordInStream() { diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java index 6c0e860fee..b6229bc129 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java @@ -28,17 +28,17 @@ import com.google.showcase.v1beta1.EchoResponse; import com.google.showcase.v1beta1.it.util.TestClientInitializer; import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -public class ITUnaryCallable { +class ITUnaryCallable { private static EchoClient grpcClient; private static EchoClient httpjsonClient; - @BeforeClass + @BeforeAll public static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); @@ -46,7 +46,7 @@ public static void createClients() throws Exception { httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); } - @AfterClass + @AfterAll public static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java index d7d12a4ad5..2b97c8528c 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java @@ -29,7 +29,7 @@ import com.google.showcase.v1beta1.it.util.TestClientInitializer; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.threeten.bp.Duration; /** @@ -39,7 +39,7 @@ *

Each test attempts to get the number of attempts done in each call. The attemptCount is * incremented by 1 as the first attempt is zero indexed. */ -public class ITUnaryDeadline { +class ITUnaryDeadline { @Test public void testGRPC_unarySuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { From 5e6dddb991ce8f99fe1bb53ad41d3271283cea86 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 05:59:35 +0000 Subject: [PATCH 04/17] removing junit 4 after migration. --- showcase/gapic-showcase/pom.xml | 10 ---------- showcase/pom.xml | 6 ------ 2 files changed, 16 deletions(-) diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 784abd5829..5a0482fab6 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -131,11 +131,6 @@ - - junit - junit - test - org.junit.platform @@ -147,11 +142,6 @@ junit-jupiter-engine test - - org.junit.vintage - junit-vintage-engine - test - org.junit.jupiter junit-jupiter-params diff --git a/showcase/pom.xml b/showcase/pom.xml index 850d9d9f7d..f36b62ee7b 100644 --- a/showcase/pom.xml +++ b/showcase/pom.xml @@ -53,12 +53,6 @@ gapic-showcase 0.0.1-SNAPSHOT - - junit - junit - 4.13.2 - test - org.junit junit-bom From 8af785a106146f152c6714cfc8e35764d93d1e1e Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 06:05:43 +0000 Subject: [PATCH 05/17] fix: rm extra blank line. --- showcase/gapic-showcase/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 5a0482fab6..732673af9c 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -131,7 +131,6 @@ - org.junit.platform junit-platform-launcher From 6f6a8d8aba31e38d59e4b9e646ac5d5d0a772581 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 06:49:29 +0000 Subject: [PATCH 06/17] update @rule TemporaryFolder to @TempDir. --- .../com/google/showcase/v1beta1/it/ITGdch.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java index d359ff5cf4..a21f7d2706 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java @@ -43,13 +43,13 @@ import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.util.concurrent.TimeUnit; -import org.junit.Rule; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.io.TempDir; /** * Test suite to confirm a client can be instantiated with GDCH credentials. No calls are made since @@ -65,8 +65,6 @@ class ITGdch { private static final String GDCH_TOKEN_STRING = "1/MkSJoj1xsli0AccessToken_NKPY2"; private static final String SID_NAME = "service-identity-name"; - @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); - private EchoClient client; private EchoSettings settings; private EchoStubSettings stubSettings; @@ -77,9 +75,9 @@ class ITGdch { private URI tokenUri; @BeforeEach - public void setup() throws IOException, URISyntaxException { + public void setup(@TempDir Path tempDir) throws IOException, URISyntaxException { transportFactory = new InterceptingMockTokenServerTransportFactory(); - prepareCredentials(); + prepareCredentials(tempDir); settings = EchoSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(initialCredentials)) @@ -94,9 +92,11 @@ public void tearDown() throws InterruptedException { } } - private void prepareCredentials() throws IOException { + private void prepareCredentials(Path tempDir) throws IOException { // Copy file so it can be referenced by Path even in native-image builds - File caCertFile = tempFolder.newFile(CA_CERT_FILENAME); + File caCertFile = new File(tempDir.toFile(), CA_CERT_FILENAME); + // Path caCertPath = tempDir.resolve(CA_CERT_FILENAME); + // File caCertFile = Files.createFile(caCertPath); try (InputStream inputStream = getClass().getResourceAsStream(CA_CERT_RESOURCE_PATH)) { assertThat(inputStream).isNotNull(); Files.copy(inputStream, caCertFile.toPath(), StandardCopyOption.REPLACE_EXISTING); @@ -115,7 +115,7 @@ private void prepareCredentials() throws IOException { projectId = converted.get("project").toString(); tokenUri = URI.create(converted.get("token_uri").toString()); - File tempGdchCredentialFile = tempFolder.newFile(GDCH_CREDENTIAL_FILENAME); + File tempGdchCredentialFile = new File(tempDir.toFile(), GDCH_CREDENTIAL_FILENAME); try (FileWriter fileWriter = new FileWriter(tempGdchCredentialFile)) { String preparedJson = converted.toPrettyString(); fileWriter.write(preparedJson); From 8010c15ac23be02f60a892ca927dd2fbb30adabc Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Thu, 9 May 2024 07:41:32 +0000 Subject: [PATCH 07/17] update missed package names, remove implicit junit 4 from truth, and add unit-vintage-engine. --- showcase/gapic-showcase/pom.xml | 11 +++++++++++ .../showcase/v1beta1/it/ITAutoPopulatedFields.java | 2 +- .../showcase/v1beta1/it/ITClientSideStreaming.java | 2 +- .../google/showcase/v1beta1/it/ITEndpointContext.java | 2 +- .../java/com/google/showcase/v1beta1/it/ITGdch.java | 4 ++-- .../java/com/google/showcase/v1beta1/it/ITIam.java | 2 +- .../showcase/v1beta1/it/ITLongRunningOperation.java | 2 +- .../com/google/showcase/v1beta1/it/ITOtelMetrics.java | 2 +- .../showcase/v1beta1/it/ITServerSideStreaming.java | 2 +- .../google/showcase/v1beta1/it/ITUnaryCallable.java | 2 +- .../google/showcase/v1beta1/it/ITUnaryDeadline.java | 2 +- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 732673af9c..67241145ff 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -141,6 +141,11 @@ junit-jupiter-engine test + + org.junit.vintage + junit-vintage-engine + test + org.junit.jupiter junit-jupiter-params @@ -150,6 +155,12 @@ com.google.truth truth 1.4.2 + + + junit + junit + + test diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java index d954e99a7e..f9595df978 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java @@ -15,7 +15,7 @@ */ package com.google.showcase.v1beta1.it; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.api.gax.httpjson.ApiMethodDescriptor; import com.google.api.gax.httpjson.ForwardingHttpJsonClientCall; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java index a047abb242..aab041982a 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java @@ -17,7 +17,7 @@ package com.google.showcase.v1beta1.it; 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.api.core.SettableApiFuture; import com.google.api.gax.rpc.ApiStreamObserver; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java index 4c81887e42..8e5a492221 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java @@ -1,6 +1,6 @@ package com.google.showcase.v1beta1.it; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.api.gax.core.CredentialsProvider; import com.google.api.gax.core.NoCredentialsProvider; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java index a21f7d2706..6ba5172d42 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java @@ -18,8 +18,8 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java index 4aacfa2057..9041ff0219 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java @@ -16,7 +16,7 @@ package com.google.showcase.v1beta1.it; 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.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.ImmutableList; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java index d01d1df012..a62ea11909 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java @@ -16,7 +16,7 @@ package com.google.showcase.v1beta1.it; 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.api.gax.longrunning.OperationFuture; import com.google.api.gax.retrying.RetrySettings; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java index dcdffa5818..851ac1fbcd 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java @@ -30,7 +30,7 @@ package com.google.showcase.v1beta1.it; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.core.ApiFuture; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java index fd9ab96ce5..bf01099b09 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java @@ -17,7 +17,7 @@ package com.google.showcase.v1beta1.it; 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.api.gax.core.NoCredentialsProvider; import com.google.api.gax.rpc.CancelledException; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java index b6229bc129..6c3f4bf030 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java @@ -17,7 +17,7 @@ package com.google.showcase.v1beta1.it; 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.api.gax.grpc.GrpcStatusCode; import com.google.api.gax.rpc.CancelledException; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java index 2b97c8528c..98a507e5fe 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java @@ -16,7 +16,7 @@ package com.google.showcase.v1beta1.it; 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.api.gax.retrying.RetrySettings; import com.google.api.gax.retrying.RetryingFuture; From 2bae1c0d3f1790f0cac018c40e990289d9ebfd43 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 10 May 2024 06:40:41 +0000 Subject: [PATCH 08/17] fix: fix fmt. --- .../src/test/java/com/google/showcase/v1beta1/it/ITGdch.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java index 6ba5172d42..c4eb8d1997 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java @@ -18,9 +18,9 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.api.client.json.GenericJson; @@ -95,8 +95,6 @@ public void tearDown() throws InterruptedException { private void prepareCredentials(Path tempDir) throws IOException { // Copy file so it can be referenced by Path even in native-image builds File caCertFile = new File(tempDir.toFile(), CA_CERT_FILENAME); - // Path caCertPath = tempDir.resolve(CA_CERT_FILENAME); - // File caCertFile = Files.createFile(caCertPath); try (InputStream inputStream = getClass().getResourceAsStream(CA_CERT_RESOURCE_PATH)) { assertThat(inputStream).isNotNull(); Files.copy(inputStream, caCertFile.toPath(), StandardCopyOption.REPLACE_EXISTING); From fda5e7cec19b22e407154a3c8c24598604fba94b Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 10 May 2024 06:45:35 +0000 Subject: [PATCH 09/17] revert changes to generated tests. --- .../v1beta1/ComplianceClientHttpJsonTest.java | 212 +++--- .../v1beta1/ComplianceClientTest.java | 402 +++++------ .../v1beta1/EchoClientHttpJsonTest.java | 172 ++--- .../showcase/v1beta1/EchoClientTest.java | 280 ++++---- .../v1beta1/IdentityClientHttpJsonTest.java | 182 ++--- .../showcase/v1beta1/IdentityClientTest.java | 238 +++---- .../v1beta1/MessagingClientHttpJsonTest.java | 456 ++++++------ .../showcase/v1beta1/MessagingClientTest.java | 654 +++++++++--------- .../SequenceServiceClientHttpJsonTest.java | 184 ++--- .../v1beta1/SequenceServiceClientTest.java | 235 ++++--- .../v1beta1/TestingClientHttpJsonTest.java | 184 ++--- .../showcase/v1beta1/TestingClientTest.java | 234 +++---- 12 files changed, 1711 insertions(+), 1722 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java index 3ec388b992..706ab50b10 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientHttpJsonTest.java @@ -50,20 +50,20 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class ComplianceClientHttpJsonTest { +public class ComplianceClientHttpJsonTest { private static MockHttpService mockService; private static ComplianceClient client; - @BeforeAll - static void startStaticServer() throws IOException { + @BeforeClass + public static void startStaticServer() throws IOException { mockService = new MockHttpService( HttpJsonComplianceStub.getMethodDescriptors(), ComplianceSettings.getDefaultEndpoint()); @@ -78,21 +78,21 @@ static void startStaticServer() throws IOException { client = ComplianceClient.create(settings); } - @AfterAll - static void stopServer() { + @AfterClass + public static void stopServer() { client.close(); } - @BeforeEach - void setUp() {} + @Before + public void setUp() {} - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { mockService.reset(); } @Test - void repeatDataBodyTest() throws Exception { + public void repeatDataBodyTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -115,10 +115,10 @@ void repeatDataBodyTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBody(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -126,14 +126,14 @@ void repeatDataBodyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataBodyExceptionTest() throws Exception { + public void repeatDataBodyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -154,14 +154,14 @@ void repeatDataBodyExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBody(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataBodyInfoTest() throws Exception { + public void repeatDataBodyInfoTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -184,10 +184,10 @@ void repeatDataBodyInfoTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyInfo(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -195,14 +195,14 @@ void repeatDataBodyInfoTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataBodyInfoExceptionTest() throws Exception { + public void repeatDataBodyInfoExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -223,14 +223,14 @@ void repeatDataBodyInfoExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyInfo(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataQueryTest() throws Exception { + public void repeatDataQueryTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -253,10 +253,10 @@ void repeatDataQueryTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataQuery(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -264,14 +264,14 @@ void repeatDataQueryTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataQueryExceptionTest() throws Exception { + public void repeatDataQueryExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -292,14 +292,14 @@ void repeatDataQueryExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataQuery(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataSimplePathTest() throws Exception { + public void repeatDataSimplePathTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -345,10 +345,10 @@ void repeatDataSimplePathTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataSimplePath(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -356,14 +356,14 @@ void repeatDataSimplePathTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataSimplePathExceptionTest() throws Exception { + public void repeatDataSimplePathExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -407,14 +407,14 @@ void repeatDataSimplePathExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataSimplePath(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataPathResourceTest() throws Exception { + public void repeatDataPathResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -474,10 +474,10 @@ void repeatDataPathResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathResource(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -485,14 +485,14 @@ void repeatDataPathResourceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataPathResourceExceptionTest() throws Exception { + public void repeatDataPathResourceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -550,14 +550,14 @@ void repeatDataPathResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathResource(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataPathTrailingResourceTest() throws Exception { + public void repeatDataPathTrailingResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -617,10 +617,10 @@ void repeatDataPathTrailingResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathTrailingResource(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -628,14 +628,14 @@ void repeatDataPathTrailingResourceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataPathTrailingResourceExceptionTest() throws Exception { + public void repeatDataPathTrailingResourceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -693,14 +693,14 @@ void repeatDataPathTrailingResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathTrailingResource(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataBodyPutTest() throws Exception { + public void repeatDataBodyPutTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -723,10 +723,10 @@ void repeatDataBodyPutTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPut(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -734,14 +734,14 @@ void repeatDataBodyPutTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataBodyPutExceptionTest() throws Exception { + public void repeatDataBodyPutExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -762,14 +762,14 @@ void repeatDataBodyPutExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPut(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataBodyPatchTest() throws Exception { + public void repeatDataBodyPatchTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -792,10 +792,10 @@ void repeatDataBodyPatchTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPatch(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -803,14 +803,14 @@ void repeatDataBodyPatchTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void repeatDataBodyPatchExceptionTest() throws Exception { + public void repeatDataBodyPatchExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -831,14 +831,14 @@ void repeatDataBodyPatchExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPatch(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getEnumTest() throws Exception { + public void getEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -849,10 +849,10 @@ void getEnumTest() throws Exception { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); EnumResponse actualResponse = client.getEnum(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -860,14 +860,14 @@ void getEnumTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getEnumExceptionTest() throws Exception { + public void getEnumExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -876,14 +876,14 @@ void getEnumExceptionTest() throws Exception { try { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); client.getEnum(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void verifyEnumTest() throws Exception { + public void verifyEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -898,10 +898,10 @@ void verifyEnumTest() throws Exception { .build(); EnumResponse actualResponse = client.verifyEnum(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -909,14 +909,14 @@ void verifyEnumTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void verifyEnumExceptionTest() throws Exception { + public void verifyEnumExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -929,14 +929,14 @@ void verifyEnumExceptionTest() throws Exception { .setContinent(Continent.forNumber(0)) .build(); client.verifyEnum(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -957,11 +957,11 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -969,14 +969,14 @@ void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -991,14 +991,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -1015,10 +1015,10 @@ void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1026,14 +1026,14 @@ void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1045,14 +1045,14 @@ void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1070,10 +1070,10 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1081,14 +1081,14 @@ void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1102,14 +1102,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1126,10 +1126,10 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1137,14 +1137,14 @@ void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1157,14 +1157,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -1176,10 +1176,10 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1187,14 +1187,14 @@ void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1207,7 +1207,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java index d421410d64..e1a3d15c2c 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/ComplianceClientTest.java @@ -50,15 +50,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class ComplianceClientTest { +public class ComplianceClientTest { private static MockCompliance mockCompliance; private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; @@ -66,8 +66,8 @@ class ComplianceClientTest { private LocalChannelProvider channelProvider; private ComplianceClient client; - @BeforeAll - static void startStaticServer() { + @BeforeClass + public static void startStaticServer() { mockCompliance = new MockCompliance(); mockLocations = new MockLocations(); mockIAMPolicy = new MockIAMPolicy(); @@ -78,13 +78,13 @@ static void startStaticServer() { mockServiceHelper.start(); } - @AfterAll - static void stopServer() { + @AfterClass + public static void stopServer() { mockServiceHelper.stop(); } - @BeforeEach - void setUp() throws IOException { + @Before + public void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); ComplianceSettings settings = @@ -95,13 +95,13 @@ void setUp() throws IOException { client = ComplianceClient.create(settings); } - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { client.close(); } @Test - void repeatDataBodyTest() throws Exception { + public void repeatDataBodyTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -124,30 +124,30 @@ void repeatDataBodyTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBody(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataBodyExceptionTest() throws Exception { + public void repeatDataBodyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -166,14 +166,14 @@ void repeatDataBodyExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBody(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataBodyInfoTest() throws Exception { + public void repeatDataBodyInfoTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -196,30 +196,30 @@ void repeatDataBodyInfoTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyInfo(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataBodyInfoExceptionTest() throws Exception { + public void repeatDataBodyInfoExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -238,14 +238,14 @@ void repeatDataBodyInfoExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyInfo(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataQueryTest() throws Exception { + public void repeatDataQueryTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -268,30 +268,30 @@ void repeatDataQueryTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataQuery(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataQueryExceptionTest() throws Exception { + public void repeatDataQueryExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -310,14 +310,14 @@ void repeatDataQueryExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataQuery(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataSimplePathTest() throws Exception { + public void repeatDataSimplePathTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -340,30 +340,30 @@ void repeatDataSimplePathTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataSimplePath(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataSimplePathExceptionTest() throws Exception { + public void repeatDataSimplePathExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -382,14 +382,14 @@ void repeatDataSimplePathExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataSimplePath(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataPathResourceTest() throws Exception { + public void repeatDataPathResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -412,30 +412,30 @@ void repeatDataPathResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathResource(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataPathResourceExceptionTest() throws Exception { + public void repeatDataPathResourceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -454,14 +454,14 @@ void repeatDataPathResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathResource(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataPathTrailingResourceTest() throws Exception { + public void repeatDataPathTrailingResourceTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -484,30 +484,30 @@ void repeatDataPathTrailingResourceTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataPathTrailingResource(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataPathTrailingResourceExceptionTest() throws Exception { + public void repeatDataPathTrailingResourceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -526,14 +526,14 @@ void repeatDataPathTrailingResourceExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataPathTrailingResource(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataBodyPutTest() throws Exception { + public void repeatDataBodyPutTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -556,30 +556,30 @@ void repeatDataBodyPutTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPut(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataBodyPutExceptionTest() throws Exception { + public void repeatDataBodyPutExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -598,14 +598,14 @@ void repeatDataBodyPutExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPut(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void repeatDataBodyPatchTest() throws Exception { + public void repeatDataBodyPatchTest() throws Exception { RepeatResponse expectedResponse = RepeatResponse.newBuilder() .setRequest(RepeatRequest.newBuilder().build()) @@ -628,30 +628,30 @@ void repeatDataBodyPatchTest() throws Exception { .build(); RepeatResponse actualResponse = client.repeatDataBodyPatch(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); RepeatRequest actualRequest = ((RepeatRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getInfo(), actualRequest.getInfo()); - Assertions.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); - Assertions.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); - Assertions.assertEquals(request.getFInt32(), actualRequest.getFInt32()); - Assertions.assertEquals(request.getFInt64(), actualRequest.getFInt64()); - Assertions.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); - Assertions.assertEquals(request.getPInt32(), actualRequest.getPInt32()); - Assertions.assertEquals(request.getPInt64(), actualRequest.getPInt64()); - Assertions.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getInfo(), actualRequest.getInfo()); + Assert.assertEquals(request.getServerVerify(), actualRequest.getServerVerify()); + Assert.assertEquals(request.getIntendedBindingUri(), actualRequest.getIntendedBindingUri()); + Assert.assertEquals(request.getFInt32(), actualRequest.getFInt32()); + Assert.assertEquals(request.getFInt64(), actualRequest.getFInt64()); + Assert.assertEquals(request.getFDouble(), actualRequest.getFDouble(), 0.0001); + Assert.assertEquals(request.getPInt32(), actualRequest.getPInt32()); + Assert.assertEquals(request.getPInt64(), actualRequest.getPInt64()); + Assert.assertEquals(request.getPDouble(), actualRequest.getPDouble(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void repeatDataBodyPatchExceptionTest() throws Exception { + public void repeatDataBodyPatchExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -670,14 +670,14 @@ void repeatDataBodyPatchExceptionTest() throws Exception { .setPDouble(-991225216) .build(); client.repeatDataBodyPatch(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getEnumTest() throws Exception { + public void getEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -688,35 +688,35 @@ void getEnumTest() throws Exception { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); EnumResponse actualResponse = client.getEnum(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); EnumRequest actualRequest = ((EnumRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getUnknownEnum(), actualRequest.getUnknownEnum()); - Assertions.assertTrue( + Assert.assertEquals(request.getUnknownEnum(), actualRequest.getUnknownEnum()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getEnumExceptionTest() throws Exception { + public void getEnumExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); try { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); client.getEnum(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void verifyEnumTest() throws Exception { + public void verifyEnumTest() throws Exception { EnumResponse expectedResponse = EnumResponse.newBuilder() .setRequest(EnumRequest.newBuilder().build()) @@ -731,22 +731,22 @@ void verifyEnumTest() throws Exception { .build(); EnumResponse actualResponse = client.verifyEnum(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCompliance.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); EnumResponse actualRequest = ((EnumResponse) actualRequests.get(0)); - Assertions.assertEquals(request.getRequest(), actualRequest.getRequest()); - Assertions.assertEquals(request.getContinent(), actualRequest.getContinent()); - Assertions.assertTrue( + Assert.assertEquals(request.getRequest(), actualRequest.getRequest()); + Assert.assertEquals(request.getContinent(), actualRequest.getContinent()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void verifyEnumExceptionTest() throws Exception { + public void verifyEnumExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockCompliance.addException(exception); @@ -757,14 +757,14 @@ void verifyEnumExceptionTest() throws Exception { .setContinent(Continent.forNumber(0)) .build(); client.verifyEnum(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -785,25 +785,25 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -816,14 +816,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -837,35 +837,35 @@ void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -883,23 +883,23 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -911,14 +911,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -935,22 +935,22 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -961,14 +961,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -980,22 +980,22 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1006,7 +1006,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java index 7b966d3f07..13e8c39eb7 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientHttpJsonTest.java @@ -57,19 +57,19 @@ import java.util.Map; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class EchoClientHttpJsonTest { +public class EchoClientHttpJsonTest { private static MockHttpService mockService; private static EchoClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -85,21 +85,21 @@ public static void startStaticServer() throws IOException { client = EchoClient.create(settings); } - @AfterAll + @AfterClass public static void stopServer() { client.close(); } - @BeforeEach - void setUp() {} + @Before + public void setUp() {} - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { mockService.reset(); } @Test - void echoTest() throws Exception { + public void echoTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -115,10 +115,10 @@ void echoTest() throws Exception { .build(); EchoResponse actualResponse = client.echo(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -126,14 +126,14 @@ void echoTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void echoExceptionTest() throws Exception { + public void echoExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -147,17 +147,17 @@ void echoExceptionTest() throws Exception { .setOtherHeader("otherHeader-2026585667") .build(); client.echo(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void expandTest() throws Exception {} + public void expandTest() throws Exception {} @Test - void expandExceptionTest() throws Exception { + public void expandExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -165,19 +165,19 @@ void expandExceptionTest() throws Exception { } @Test - void collectUnsupportedMethodTest() throws Exception { + public void collectUnsupportedMethodTest() throws Exception { // The collect() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - void chatUnsupportedMethodTest() throws Exception { + public void chatUnsupportedMethodTest() throws Exception { // The chat() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - void pagedExpandTest() throws Exception { + public void pagedExpandTest() throws Exception { EchoResponse responsesElement = EchoResponse.newBuilder().build(); PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() @@ -197,11 +197,11 @@ void pagedExpandTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -209,14 +209,14 @@ void pagedExpandTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void pagedExpandExceptionTest() throws Exception { + public void pagedExpandExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -230,14 +230,14 @@ void pagedExpandExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpand(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void pagedExpandLegacyTest() throws Exception { + public void pagedExpandLegacyTest() throws Exception { PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() .addAllResponses(new ArrayList()) @@ -253,10 +253,10 @@ void pagedExpandLegacyTest() throws Exception { .build(); PagedExpandResponse actualResponse = client.pagedExpandLegacy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -264,14 +264,14 @@ void pagedExpandLegacyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void pagedExpandLegacyExceptionTest() throws Exception { + public void pagedExpandLegacyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -285,14 +285,14 @@ void pagedExpandLegacyExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void pagedExpandLegacyMappedTest() throws Exception { + public void pagedExpandLegacyMappedTest() throws Exception { PagedExpandResponseList responsesElement = PagedExpandResponseList.newBuilder().build(); PagedExpandLegacyMappedResponse expectedResponse = PagedExpandLegacyMappedResponse.newBuilder() @@ -314,12 +314,12 @@ void pagedExpandLegacyMappedTest() throws Exception { List> resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals( + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( expectedResponse.getAlphabetizedMap().entrySet().iterator().next(), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -327,14 +327,14 @@ void pagedExpandLegacyMappedTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void pagedExpandLegacyMappedExceptionTest() throws Exception { + public void pagedExpandLegacyMappedExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -348,14 +348,14 @@ void pagedExpandLegacyMappedExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacyMapped(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void waitTest() throws Exception { + public void waitTest() throws Exception { WaitResponse expectedResponse = WaitResponse.newBuilder().setContent("content951530617").build(); Operation resultOperation = @@ -369,10 +369,10 @@ void waitTest() throws Exception { WaitRequest request = WaitRequest.newBuilder().build(); WaitResponse actualResponse = client.waitAsync(request).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -380,14 +380,14 @@ void waitTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void waitExceptionTest() throws Exception { + public void waitExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -396,13 +396,13 @@ void waitExceptionTest() throws Exception { try { WaitRequest request = WaitRequest.newBuilder().build(); client.waitAsync(request).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - void blockTest() throws Exception { + public void blockTest() throws Exception { BlockResponse expectedResponse = BlockResponse.newBuilder().setContent("content951530617").build(); mockService.addResponse(expectedResponse); @@ -411,10 +411,10 @@ void blockTest() throws Exception { BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); BlockResponse actualResponse = client.block(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -422,14 +422,14 @@ void blockTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void blockExceptionTest() throws Exception { + public void blockExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -439,14 +439,14 @@ void blockExceptionTest() throws Exception { BlockRequest request = BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); client.block(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -467,11 +467,11 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -479,14 +479,14 @@ void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -501,14 +501,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -525,10 +525,10 @@ void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -536,14 +536,14 @@ void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -555,14 +555,14 @@ void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -580,10 +580,10 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -591,14 +591,14 @@ void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -612,14 +612,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -636,10 +636,10 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -647,14 +647,14 @@ void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -667,14 +667,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -686,10 +686,10 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -697,14 +697,14 @@ void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -717,7 +717,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java index 399067c627..7fdd669677 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/EchoClientTest.java @@ -64,15 +64,15 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class EchoClientTest { +public class EchoClientTest { private static MockEcho mockEcho; private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; @@ -80,7 +80,7 @@ class EchoClientTest { private LocalChannelProvider channelProvider; private EchoClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() { mockEcho = new MockEcho(); mockLocations = new MockLocations(); @@ -92,13 +92,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterAll + @AfterClass public static void stopServer() { mockServiceHelper.stop(); } - @BeforeEach - void setUp() throws IOException { + @Before + public void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); EchoSettings settings = @@ -109,13 +109,13 @@ void setUp() throws IOException { client = EchoClient.create(settings); } - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { client.close(); } @Test - void echoTest() throws Exception { + public void echoTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -131,25 +131,25 @@ void echoTest() throws Exception { .build(); EchoResponse actualResponse = client.echo(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); EchoRequest actualRequest = ((EchoRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getContent(), actualRequest.getContent()); - Assertions.assertEquals(request.getError(), actualRequest.getError()); - Assertions.assertEquals(request.getSeverity(), actualRequest.getSeverity()); - Assertions.assertEquals(request.getHeader(), actualRequest.getHeader()); - Assertions.assertEquals(request.getOtherHeader(), actualRequest.getOtherHeader()); - Assertions.assertTrue( + Assert.assertEquals(request.getContent(), actualRequest.getContent()); + Assert.assertEquals(request.getError(), actualRequest.getError()); + Assert.assertEquals(request.getSeverity(), actualRequest.getSeverity()); + Assert.assertEquals(request.getHeader(), actualRequest.getHeader()); + Assert.assertEquals(request.getOtherHeader(), actualRequest.getOtherHeader()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void echoExceptionTest() throws Exception { + public void echoExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -161,14 +161,14 @@ void echoExceptionTest() throws Exception { .setOtherHeader("otherHeader-2026585667") .build(); client.echo(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void expandTest() throws Exception { + public void expandTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -188,12 +188,12 @@ void expandTest() throws Exception { callable.serverStreamingCall(request, responseObserver); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void expandExceptionTest() throws Exception { + public void expandExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); ExpandRequest request = @@ -210,17 +210,16 @@ void expandExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void collectTest() throws Exception { + public void collectTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -243,12 +242,12 @@ void collectTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void collectExceptionTest() throws Exception { + public void collectExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); EchoRequest request = @@ -267,17 +266,16 @@ void collectExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void chatTest() throws Exception { + public void chatTest() throws Exception { EchoResponse expectedResponse = EchoResponse.newBuilder() .setContent("content951530617") @@ -300,12 +298,12 @@ void chatTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void chatExceptionTest() throws Exception { + public void chatExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); EchoRequest request = @@ -324,17 +322,16 @@ void chatExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void pagedExpandTest() throws Exception { + public void pagedExpandTest() throws Exception { EchoResponse responsesElement = EchoResponse.newBuilder().build(); PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() @@ -354,24 +351,24 @@ void pagedExpandTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResponsesList().get(0), resources.get(0)); List actualRequests = mockEcho.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); PagedExpandRequest actualRequest = ((PagedExpandRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getContent(), actualRequest.getContent()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getContent(), actualRequest.getContent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void pagedExpandExceptionTest() throws Exception { + public void pagedExpandExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -383,14 +380,14 @@ void pagedExpandExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpand(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void pagedExpandLegacyTest() throws Exception { + public void pagedExpandLegacyTest() throws Exception { PagedExpandResponse expectedResponse = PagedExpandResponse.newBuilder() .addAllResponses(new ArrayList()) @@ -406,23 +403,23 @@ void pagedExpandLegacyTest() throws Exception { .build(); PagedExpandResponse actualResponse = client.pagedExpandLegacy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); PagedExpandLegacyRequest actualRequest = ((PagedExpandLegacyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getContent(), actualRequest.getContent()); - Assertions.assertEquals(request.getMaxResults(), actualRequest.getMaxResults()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getContent(), actualRequest.getContent()); + Assert.assertEquals(request.getMaxResults(), actualRequest.getMaxResults()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void pagedExpandLegacyExceptionTest() throws Exception { + public void pagedExpandLegacyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -434,14 +431,14 @@ void pagedExpandLegacyExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void pagedExpandLegacyMappedTest() throws Exception { + public void pagedExpandLegacyMappedTest() throws Exception { PagedExpandResponseList responsesElement = PagedExpandResponseList.newBuilder().build(); PagedExpandLegacyMappedResponse expectedResponse = PagedExpandLegacyMappedResponse.newBuilder() @@ -463,25 +460,25 @@ void pagedExpandLegacyMappedTest() throws Exception { List> resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals( + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( expectedResponse.getAlphabetizedMap().entrySet().iterator().next(), resources.get(0)); List actualRequests = mockEcho.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); PagedExpandRequest actualRequest = ((PagedExpandRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getContent(), actualRequest.getContent()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getContent(), actualRequest.getContent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void pagedExpandLegacyMappedExceptionTest() throws Exception { + public void pagedExpandLegacyMappedExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -493,14 +490,14 @@ void pagedExpandLegacyMappedExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.pagedExpandLegacyMapped(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void waitTest() throws Exception { + public void waitTest() throws Exception { WaitResponse expectedResponse = WaitResponse.newBuilder().setContent("content951530617").build(); Operation resultOperation = @@ -514,41 +511,40 @@ void waitTest() throws Exception { WaitRequest request = WaitRequest.newBuilder().build(); WaitResponse actualResponse = client.waitAsync(request).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); WaitRequest actualRequest = ((WaitRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getEndTime(), actualRequest.getEndTime()); - Assertions.assertEquals(request.getTtl(), actualRequest.getTtl()); - Assertions.assertEquals(request.getError(), actualRequest.getError()); - Assertions.assertEquals(request.getSuccess(), actualRequest.getSuccess()); - Assertions.assertTrue( + Assert.assertEquals(request.getEndTime(), actualRequest.getEndTime()); + Assert.assertEquals(request.getTtl(), actualRequest.getTtl()); + Assert.assertEquals(request.getError(), actualRequest.getError()); + Assert.assertEquals(request.getSuccess(), actualRequest.getSuccess()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void waitExceptionTest() throws Exception { + public void waitExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); try { WaitRequest request = WaitRequest.newBuilder().build(); client.waitAsync(request).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { - Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void blockTest() throws Exception { + public void blockTest() throws Exception { BlockResponse expectedResponse = BlockResponse.newBuilder().setContent("content951530617").build(); mockEcho.addResponse(expectedResponse); @@ -557,23 +553,23 @@ void blockTest() throws Exception { BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); BlockResponse actualResponse = client.block(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockEcho.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); BlockRequest actualRequest = ((BlockRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResponseDelay(), actualRequest.getResponseDelay()); - Assertions.assertEquals(request.getError(), actualRequest.getError()); - Assertions.assertEquals(request.getSuccess(), actualRequest.getSuccess()); - Assertions.assertTrue( + Assert.assertEquals(request.getResponseDelay(), actualRequest.getResponseDelay()); + Assert.assertEquals(request.getError(), actualRequest.getError()); + Assert.assertEquals(request.getSuccess(), actualRequest.getSuccess()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void blockExceptionTest() throws Exception { + public void blockExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockEcho.addException(exception); @@ -581,14 +577,14 @@ void blockExceptionTest() throws Exception { BlockRequest request = BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().build()).build(); client.block(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -609,25 +605,25 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -640,14 +636,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -661,35 +657,35 @@ void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -707,23 +703,23 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -735,14 +731,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -759,22 +755,22 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -785,14 +781,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -804,22 +800,22 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -830,7 +826,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java index d75cc6f096..8be3f3d781 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientHttpJsonTest.java @@ -53,19 +53,19 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class IdentityClientHttpJsonTest { +public class IdentityClientHttpJsonTest { private static MockHttpService mockService; private static IdentityClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -81,21 +81,21 @@ public static void startStaticServer() throws IOException { client = IdentityClient.create(settings); } - @AfterAll + @AfterClass public static void stopServer() { client.close(); } - @BeforeEach - void setUp() {} + @Before + public void setUp() {} - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { mockService.reset(); } @Test - void createUserTest() throws Exception { + public void createUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -114,10 +114,10 @@ void createUserTest() throws Exception { String email = "email96619420"; User actualResponse = client.createUser(displayName, email); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -125,14 +125,14 @@ void createUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createUserExceptionTest() throws Exception { + public void createUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -142,14 +142,14 @@ void createUserExceptionTest() throws Exception { String displayName = "displayName1714148973"; String email = "email96619420"; client.createUser(displayName, email); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createUserTest2() throws Exception { + public void createUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -173,10 +173,10 @@ void createUserTest2() throws Exception { User actualResponse = client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -184,14 +184,14 @@ void createUserTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createUserExceptionTest2() throws Exception { + public void createUserExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -205,14 +205,14 @@ void createUserExceptionTest2() throws Exception { boolean enableNotifications = true; double heightFeet = -1032737338; client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getUserTest() throws Exception { + public void getUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -230,10 +230,10 @@ void getUserTest() throws Exception { UserName name = UserName.of("[USER]"); User actualResponse = client.getUser(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -241,14 +241,14 @@ void getUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getUserExceptionTest() throws Exception { + public void getUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -257,14 +257,14 @@ void getUserExceptionTest() throws Exception { try { UserName name = UserName.of("[USER]"); client.getUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getUserTest2() throws Exception { + public void getUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -282,10 +282,10 @@ void getUserTest2() throws Exception { String name = "users/user-6376"; User actualResponse = client.getUser(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -293,14 +293,14 @@ void getUserTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getUserExceptionTest2() throws Exception { + public void getUserExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -309,14 +309,14 @@ void getUserExceptionTest2() throws Exception { try { String name = "users/user-6376"; client.getUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void updateUserTest() throws Exception { + public void updateUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -349,10 +349,10 @@ void updateUserTest() throws Exception { .build(); User actualResponse = client.updateUser(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -360,14 +360,14 @@ void updateUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void updateUserExceptionTest() throws Exception { + public void updateUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -391,14 +391,14 @@ void updateUserExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateUser(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteUserTest() throws Exception { + public void deleteUserTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -407,7 +407,7 @@ void deleteUserTest() throws Exception { client.deleteUser(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -415,14 +415,14 @@ void deleteUserTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteUserExceptionTest() throws Exception { + public void deleteUserExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -431,14 +431,14 @@ void deleteUserExceptionTest() throws Exception { try { UserName name = UserName.of("[USER]"); client.deleteUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteUserTest2() throws Exception { + public void deleteUserTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -447,7 +447,7 @@ void deleteUserTest2() throws Exception { client.deleteUser(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -455,14 +455,14 @@ void deleteUserTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteUserExceptionTest2() throws Exception { + public void deleteUserExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -471,14 +471,14 @@ void deleteUserExceptionTest2() throws Exception { try { String name = "users/user-6376"; client.deleteUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listUsersTest() throws Exception { + public void listUsersTest() throws Exception { User responsesElement = User.newBuilder().build(); ListUsersResponse expectedResponse = ListUsersResponse.newBuilder() @@ -497,11 +497,11 @@ void listUsersTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -509,14 +509,14 @@ void listUsersTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listUsersExceptionTest() throws Exception { + public void listUsersExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -529,14 +529,14 @@ void listUsersExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listUsers(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -557,11 +557,11 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -569,14 +569,14 @@ void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -591,14 +591,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -615,10 +615,10 @@ void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -626,14 +626,14 @@ void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -645,14 +645,14 @@ void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -670,10 +670,10 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -681,14 +681,14 @@ void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -702,14 +702,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -726,10 +726,10 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -737,14 +737,14 @@ void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -757,14 +757,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -776,10 +776,10 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -787,14 +787,14 @@ void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -807,7 +807,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java index 5804d2034a..bba5e80d12 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/IdentityClientTest.java @@ -53,15 +53,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class IdentityClientTest { +public class IdentityClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockIdentity mockIdentity; private static MockLocations mockLocations; @@ -69,7 +69,7 @@ class IdentityClientTest { private LocalChannelProvider channelProvider; private IdentityClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() { mockIdentity = new MockIdentity(); mockLocations = new MockLocations(); @@ -81,13 +81,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterAll + @AfterClass public static void stopServer() { mockServiceHelper.stop(); } - @BeforeEach - void setUp() throws IOException { + @Before + public void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); IdentitySettings settings = @@ -98,13 +98,13 @@ void setUp() throws IOException { client = IdentityClient.create(settings); } - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { client.close(); } @Test - void createUserTest() throws Exception { + public void createUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -123,22 +123,22 @@ void createUserTest() throws Exception { String email = "email96619420"; User actualResponse = client.createUser(displayName, email); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateUserRequest actualRequest = ((CreateUserRequest) actualRequests.get(0)); - Assertions.assertEquals(displayName, actualRequest.getUser().getDisplayName()); - Assertions.assertEquals(email, actualRequest.getUser().getEmail()); - Assertions.assertTrue( + Assert.assertEquals(displayName, actualRequest.getUser().getDisplayName()); + Assert.assertEquals(email, actualRequest.getUser().getEmail()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createUserExceptionTest() throws Exception { + public void createUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -146,14 +146,14 @@ void createUserExceptionTest() throws Exception { String displayName = "displayName1714148973"; String email = "email96619420"; client.createUser(displayName, email); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createUserTest2() throws Exception { + public void createUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -177,26 +177,26 @@ void createUserTest2() throws Exception { User actualResponse = client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateUserRequest actualRequest = ((CreateUserRequest) actualRequests.get(0)); - Assertions.assertEquals(displayName, actualRequest.getUser().getDisplayName()); - Assertions.assertEquals(email, actualRequest.getUser().getEmail()); - Assertions.assertEquals(age, actualRequest.getUser().getAge()); - Assertions.assertEquals(nickname, actualRequest.getUser().getNickname()); - Assertions.assertEquals(enableNotifications, actualRequest.getUser().getEnableNotifications()); - Assertions.assertEquals(heightFeet, actualRequest.getUser().getHeightFeet(), 0.0001); - Assertions.assertTrue( + Assert.assertEquals(displayName, actualRequest.getUser().getDisplayName()); + Assert.assertEquals(email, actualRequest.getUser().getEmail()); + Assert.assertEquals(age, actualRequest.getUser().getAge()); + Assert.assertEquals(nickname, actualRequest.getUser().getNickname()); + Assert.assertEquals(enableNotifications, actualRequest.getUser().getEnableNotifications()); + Assert.assertEquals(heightFeet, actualRequest.getUser().getHeightFeet(), 0.0001); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createUserExceptionTest2() throws Exception { + public void createUserExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -208,14 +208,14 @@ void createUserExceptionTest2() throws Exception { boolean enableNotifications = true; double heightFeet = -1032737338; client.createUser(displayName, email, age, nickname, enableNotifications, heightFeet); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getUserTest() throws Exception { + public void getUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -233,35 +233,35 @@ void getUserTest() throws Exception { UserName name = UserName.of("[USER]"); User actualResponse = client.getUser(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetUserRequest actualRequest = ((GetUserRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getUserExceptionTest() throws Exception { + public void getUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { UserName name = UserName.of("[USER]"); client.getUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getUserTest2() throws Exception { + public void getUserTest2() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -279,35 +279,35 @@ void getUserTest2() throws Exception { String name = "name3373707"; User actualResponse = client.getUser(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetUserRequest actualRequest = ((GetUserRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getUserExceptionTest2() throws Exception { + public void getUserExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { String name = "name3373707"; client.getUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void updateUserTest() throws Exception { + public void updateUserTest() throws Exception { User expectedResponse = User.newBuilder() .setName(UserName.of("[USER]").toString()) @@ -329,22 +329,22 @@ void updateUserTest() throws Exception { .build(); User actualResponse = client.updateUser(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); UpdateUserRequest actualRequest = ((UpdateUserRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getUser(), actualRequest.getUser()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getUser(), actualRequest.getUser()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void updateUserExceptionTest() throws Exception { + public void updateUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -355,14 +355,14 @@ void updateUserExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateUser(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteUserTest() throws Exception { + public void deleteUserTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockIdentity.addResponse(expectedResponse); @@ -371,32 +371,32 @@ void deleteUserTest() throws Exception { client.deleteUser(name); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteUserRequest actualRequest = ((DeleteUserRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteUserExceptionTest() throws Exception { + public void deleteUserExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { UserName name = UserName.of("[USER]"); client.deleteUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteUserTest2() throws Exception { + public void deleteUserTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockIdentity.addResponse(expectedResponse); @@ -405,32 +405,32 @@ void deleteUserTest2() throws Exception { client.deleteUser(name); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteUserRequest actualRequest = ((DeleteUserRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteUserExceptionTest2() throws Exception { + public void deleteUserExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); try { String name = "name3373707"; client.deleteUser(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listUsersTest() throws Exception { + public void listUsersTest() throws Exception { User responsesElement = User.newBuilder().build(); ListUsersResponse expectedResponse = ListUsersResponse.newBuilder() @@ -449,23 +449,23 @@ void listUsersTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUsersList().get(0), resources.get(0)); List actualRequests = mockIdentity.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListUsersRequest actualRequest = ((ListUsersRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listUsersExceptionTest() throws Exception { + public void listUsersExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIdentity.addException(exception); @@ -476,14 +476,14 @@ void listUsersExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listUsers(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -504,25 +504,25 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -535,14 +535,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -556,35 +556,35 @@ void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -602,23 +602,23 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -630,14 +630,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -654,22 +654,22 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -680,14 +680,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -699,22 +699,22 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -725,7 +725,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java index 4f92c398df..f943d18786 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientHttpJsonTest.java @@ -56,19 +56,19 @@ import java.util.List; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class MessagingClientHttpJsonTest { +public class MessagingClientHttpJsonTest { private static MockHttpService mockService; private static MessagingClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -84,21 +84,21 @@ public static void startStaticServer() throws IOException { client = MessagingClient.create(settings); } - @AfterAll + @AfterClass public static void stopServer() { client.close(); } - @BeforeEach - void setUp() {} + @Before + public void setUp() {} - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { mockService.reset(); } @Test - void createRoomTest() throws Exception { + public void createRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -113,10 +113,10 @@ void createRoomTest() throws Exception { String description = "description-1724546052"; Room actualResponse = client.createRoom(displayName, description); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -124,14 +124,14 @@ void createRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createRoomExceptionTest() throws Exception { + public void createRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -141,14 +141,14 @@ void createRoomExceptionTest() throws Exception { String displayName = "displayName1714148973"; String description = "description-1724546052"; client.createRoom(displayName, description); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getRoomTest() throws Exception { + public void getRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -162,10 +162,10 @@ void getRoomTest() throws Exception { RoomName name = RoomName.of("[ROOM]"); Room actualResponse = client.getRoom(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -173,14 +173,14 @@ void getRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getRoomExceptionTest() throws Exception { + public void getRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -189,14 +189,14 @@ void getRoomExceptionTest() throws Exception { try { RoomName name = RoomName.of("[ROOM]"); client.getRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getRoomTest2() throws Exception { + public void getRoomTest2() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -210,10 +210,10 @@ void getRoomTest2() throws Exception { String name = "rooms/room-472"; Room actualResponse = client.getRoom(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -221,14 +221,14 @@ void getRoomTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getRoomExceptionTest2() throws Exception { + public void getRoomExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -237,14 +237,14 @@ void getRoomExceptionTest2() throws Exception { try { String name = "rooms/room-472"; client.getRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void updateRoomTest() throws Exception { + public void updateRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -269,10 +269,10 @@ void updateRoomTest() throws Exception { .build(); Room actualResponse = client.updateRoom(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -280,14 +280,14 @@ void updateRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void updateRoomExceptionTest() throws Exception { + public void updateRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -307,14 +307,14 @@ void updateRoomExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateRoom(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteRoomTest() throws Exception { + public void deleteRoomTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -323,7 +323,7 @@ void deleteRoomTest() throws Exception { client.deleteRoom(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -331,14 +331,14 @@ void deleteRoomTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteRoomExceptionTest() throws Exception { + public void deleteRoomExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -347,14 +347,14 @@ void deleteRoomExceptionTest() throws Exception { try { RoomName name = RoomName.of("[ROOM]"); client.deleteRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteRoomTest2() throws Exception { + public void deleteRoomTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -363,7 +363,7 @@ void deleteRoomTest2() throws Exception { client.deleteRoom(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -371,14 +371,14 @@ void deleteRoomTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteRoomExceptionTest2() throws Exception { + public void deleteRoomExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -387,14 +387,14 @@ void deleteRoomExceptionTest2() throws Exception { try { String name = "rooms/room-472"; client.deleteRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listRoomsTest() throws Exception { + public void listRoomsTest() throws Exception { Room responsesElement = Room.newBuilder().build(); ListRoomsResponse expectedResponse = ListRoomsResponse.newBuilder() @@ -413,11 +413,11 @@ void listRoomsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -425,14 +425,14 @@ void listRoomsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listRoomsExceptionTest() throws Exception { + public void listRoomsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -445,14 +445,14 @@ void listRoomsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listRooms(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest() throws Exception { + public void createBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -469,10 +469,10 @@ void createBlurbTest() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -480,14 +480,14 @@ void createBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest() throws Exception { + public void createBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -498,14 +498,14 @@ void createBlurbExceptionTest() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest2() throws Exception { + public void createBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -522,10 +522,10 @@ void createBlurbTest2() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -533,14 +533,14 @@ void createBlurbTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest2() throws Exception { + public void createBlurbExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -551,14 +551,14 @@ void createBlurbExceptionTest2() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest3() throws Exception { + public void createBlurbTest3() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -575,10 +575,10 @@ void createBlurbTest3() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -586,14 +586,14 @@ void createBlurbTest3() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest3() throws Exception { + public void createBlurbExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -604,14 +604,14 @@ void createBlurbExceptionTest3() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest4() throws Exception { + public void createBlurbTest4() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -628,10 +628,10 @@ void createBlurbTest4() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -639,14 +639,14 @@ void createBlurbTest4() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest4() throws Exception { + public void createBlurbExceptionTest4() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -657,14 +657,14 @@ void createBlurbExceptionTest4() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest5() throws Exception { + public void createBlurbTest5() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -681,10 +681,10 @@ void createBlurbTest5() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -692,14 +692,14 @@ void createBlurbTest5() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest5() throws Exception { + public void createBlurbExceptionTest5() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -710,14 +710,14 @@ void createBlurbExceptionTest5() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest6() throws Exception { + public void createBlurbTest6() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -734,10 +734,10 @@ void createBlurbTest6() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -745,14 +745,14 @@ void createBlurbTest6() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest6() throws Exception { + public void createBlurbExceptionTest6() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -763,14 +763,14 @@ void createBlurbExceptionTest6() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest7() throws Exception { + public void createBlurbTest7() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -787,10 +787,10 @@ void createBlurbTest7() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -798,14 +798,14 @@ void createBlurbTest7() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest7() throws Exception { + public void createBlurbExceptionTest7() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -816,14 +816,14 @@ void createBlurbExceptionTest7() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest8() throws Exception { + public void createBlurbTest8() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -840,10 +840,10 @@ void createBlurbTest8() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -851,14 +851,14 @@ void createBlurbTest8() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest8() throws Exception { + public void createBlurbExceptionTest8() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -869,14 +869,14 @@ void createBlurbExceptionTest8() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest9() throws Exception { + public void createBlurbTest9() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -893,10 +893,10 @@ void createBlurbTest9() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -904,14 +904,14 @@ void createBlurbTest9() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest9() throws Exception { + public void createBlurbExceptionTest9() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -922,14 +922,14 @@ void createBlurbExceptionTest9() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest10() throws Exception { + public void createBlurbTest10() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -946,10 +946,10 @@ void createBlurbTest10() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -957,14 +957,14 @@ void createBlurbTest10() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest10() throws Exception { + public void createBlurbExceptionTest10() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -975,14 +975,14 @@ void createBlurbExceptionTest10() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest11() throws Exception { + public void createBlurbTest11() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -999,10 +999,10 @@ void createBlurbTest11() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1010,14 +1010,14 @@ void createBlurbTest11() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest11() throws Exception { + public void createBlurbExceptionTest11() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1028,14 +1028,14 @@ void createBlurbExceptionTest11() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest12() throws Exception { + public void createBlurbTest12() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -1052,10 +1052,10 @@ void createBlurbTest12() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1063,14 +1063,14 @@ void createBlurbTest12() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createBlurbExceptionTest12() throws Exception { + public void createBlurbExceptionTest12() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1081,14 +1081,14 @@ void createBlurbExceptionTest12() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getBlurbTest() throws Exception { + public void getBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1101,10 +1101,10 @@ void getBlurbTest() throws Exception { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); Blurb actualResponse = client.getBlurb(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1112,14 +1112,14 @@ void getBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getBlurbExceptionTest() throws Exception { + public void getBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1128,14 +1128,14 @@ void getBlurbExceptionTest() throws Exception { try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.getBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getBlurbTest2() throws Exception { + public void getBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1148,10 +1148,10 @@ void getBlurbTest2() throws Exception { String name = "rooms/room-9094/blurbs/blurb-9094"; Blurb actualResponse = client.getBlurb(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1159,14 +1159,14 @@ void getBlurbTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getBlurbExceptionTest2() throws Exception { + public void getBlurbExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1175,14 +1175,14 @@ void getBlurbExceptionTest2() throws Exception { try { String name = "rooms/room-9094/blurbs/blurb-9094"; client.getBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void updateBlurbTest() throws Exception { + public void updateBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1205,10 +1205,10 @@ void updateBlurbTest() throws Exception { .build(); Blurb actualResponse = client.updateBlurb(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1216,14 +1216,14 @@ void updateBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void updateBlurbExceptionTest() throws Exception { + public void updateBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1242,14 +1242,14 @@ void updateBlurbExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateBlurb(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteBlurbTest() throws Exception { + public void deleteBlurbTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -1258,7 +1258,7 @@ void deleteBlurbTest() throws Exception { client.deleteBlurb(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1266,14 +1266,14 @@ void deleteBlurbTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteBlurbExceptionTest() throws Exception { + public void deleteBlurbExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1282,14 +1282,14 @@ void deleteBlurbExceptionTest() throws Exception { try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.deleteBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteBlurbTest2() throws Exception { + public void deleteBlurbTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -1298,7 +1298,7 @@ void deleteBlurbTest2() throws Exception { client.deleteBlurb(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1306,14 +1306,14 @@ void deleteBlurbTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteBlurbExceptionTest2() throws Exception { + public void deleteBlurbExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1322,14 +1322,14 @@ void deleteBlurbExceptionTest2() throws Exception { try { String name = "rooms/room-9094/blurbs/blurb-9094"; client.deleteBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listBlurbsTest() throws Exception { + public void listBlurbsTest() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1344,11 +1344,11 @@ void listBlurbsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1356,14 +1356,14 @@ void listBlurbsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listBlurbsExceptionTest() throws Exception { + public void listBlurbsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1372,14 +1372,14 @@ void listBlurbsExceptionTest() throws Exception { try { ProfileName parent = ProfileName.of("[USER]"); client.listBlurbs(parent); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listBlurbsTest2() throws Exception { + public void listBlurbsTest2() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1394,11 +1394,11 @@ void listBlurbsTest2() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1406,14 +1406,14 @@ void listBlurbsTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listBlurbsExceptionTest2() throws Exception { + public void listBlurbsExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1422,14 +1422,14 @@ void listBlurbsExceptionTest2() throws Exception { try { RoomName parent = RoomName.of("[ROOM]"); client.listBlurbs(parent); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listBlurbsTest3() throws Exception { + public void listBlurbsTest3() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1444,11 +1444,11 @@ void listBlurbsTest3() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1456,14 +1456,14 @@ void listBlurbsTest3() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listBlurbsExceptionTest3() throws Exception { + public void listBlurbsExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1472,14 +1472,14 @@ void listBlurbsExceptionTest3() throws Exception { try { String parent = "rooms/room-4889"; client.listBlurbs(parent); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void searchBlurbsTest() throws Exception { + public void searchBlurbsTest() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1497,10 +1497,10 @@ void searchBlurbsTest() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1508,14 +1508,14 @@ void searchBlurbsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void searchBlurbsExceptionTest() throws Exception { + public void searchBlurbsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1525,13 +1525,13 @@ void searchBlurbsExceptionTest() throws Exception { ProfileName parent = ProfileName.of("[USER]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - void searchBlurbsTest2() throws Exception { + public void searchBlurbsTest2() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1549,10 +1549,10 @@ void searchBlurbsTest2() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1560,14 +1560,14 @@ void searchBlurbsTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void searchBlurbsExceptionTest2() throws Exception { + public void searchBlurbsExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1577,13 +1577,13 @@ void searchBlurbsExceptionTest2() throws Exception { RoomName parent = RoomName.of("[ROOM]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - void searchBlurbsTest3() throws Exception { + public void searchBlurbsTest3() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1601,10 +1601,10 @@ void searchBlurbsTest3() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1612,14 +1612,14 @@ void searchBlurbsTest3() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void searchBlurbsExceptionTest3() throws Exception { + public void searchBlurbsExceptionTest3() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1629,16 +1629,16 @@ void searchBlurbsExceptionTest3() throws Exception { String parent = "rooms/room-4889"; String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { } } @Test - void streamBlurbsTest() throws Exception {} + public void streamBlurbsTest() throws Exception {} @Test - void streamBlurbsExceptionTest() throws Exception { + public void streamBlurbsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1646,19 +1646,19 @@ void streamBlurbsExceptionTest() throws Exception { } @Test - void sendBlurbsUnsupportedMethodTest() throws Exception { + public void sendBlurbsUnsupportedMethodTest() throws Exception { // The sendBlurbs() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - void connectUnsupportedMethodTest() throws Exception { + public void connectUnsupportedMethodTest() throws Exception { // The connect() method is not supported in REST transport. // This empty test is generated for technical reasons. } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -1679,11 +1679,11 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1691,14 +1691,14 @@ void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1713,14 +1713,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -1737,10 +1737,10 @@ void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1748,14 +1748,14 @@ void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1767,14 +1767,14 @@ void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1792,10 +1792,10 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1803,14 +1803,14 @@ void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1824,14 +1824,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1848,10 +1848,10 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1859,14 +1859,14 @@ void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1879,14 +1879,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -1898,10 +1898,10 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -1909,14 +1909,14 @@ void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -1929,7 +1929,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java index 273a8e1f61..aba31f54f9 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MessagingClientTest.java @@ -62,15 +62,15 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class MessagingClientTest { +public class MessagingClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; private static MockMessaging mockMessaging; @@ -78,7 +78,7 @@ class MessagingClientTest { private LocalChannelProvider channelProvider; private MessagingClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() { mockMessaging = new MockMessaging(); mockLocations = new MockLocations(); @@ -90,13 +90,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterAll + @AfterClass public static void stopServer() { mockServiceHelper.stop(); } - @BeforeEach - void setUp() throws IOException { + @Before + public void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); MessagingSettings settings = @@ -107,13 +107,13 @@ void setUp() throws IOException { client = MessagingClient.create(settings); } - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { client.close(); } @Test - void createRoomTest() throws Exception { + public void createRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -128,22 +128,22 @@ void createRoomTest() throws Exception { String description = "description-1724546052"; Room actualResponse = client.createRoom(displayName, description); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateRoomRequest actualRequest = ((CreateRoomRequest) actualRequests.get(0)); - Assertions.assertEquals(displayName, actualRequest.getRoom().getDisplayName()); - Assertions.assertEquals(description, actualRequest.getRoom().getDescription()); - Assertions.assertTrue( + Assert.assertEquals(displayName, actualRequest.getRoom().getDisplayName()); + Assert.assertEquals(description, actualRequest.getRoom().getDescription()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createRoomExceptionTest() throws Exception { + public void createRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -151,14 +151,14 @@ void createRoomExceptionTest() throws Exception { String displayName = "displayName1714148973"; String description = "description-1724546052"; client.createRoom(displayName, description); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getRoomTest() throws Exception { + public void getRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -172,35 +172,35 @@ void getRoomTest() throws Exception { RoomName name = RoomName.of("[ROOM]"); Room actualResponse = client.getRoom(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetRoomRequest actualRequest = ((GetRoomRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getRoomExceptionTest() throws Exception { + public void getRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { RoomName name = RoomName.of("[ROOM]"); client.getRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getRoomTest2() throws Exception { + public void getRoomTest2() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -214,35 +214,35 @@ void getRoomTest2() throws Exception { String name = "name3373707"; Room actualResponse = client.getRoom(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetRoomRequest actualRequest = ((GetRoomRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getRoomExceptionTest2() throws Exception { + public void getRoomExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.getRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void updateRoomTest() throws Exception { + public void updateRoomTest() throws Exception { Room expectedResponse = Room.newBuilder() .setName(RoomName.of("[ROOM]").toString()) @@ -260,22 +260,22 @@ void updateRoomTest() throws Exception { .build(); Room actualResponse = client.updateRoom(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); UpdateRoomRequest actualRequest = ((UpdateRoomRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getRoom(), actualRequest.getRoom()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getRoom(), actualRequest.getRoom()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void updateRoomExceptionTest() throws Exception { + public void updateRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -286,14 +286,14 @@ void updateRoomExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateRoom(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteRoomTest() throws Exception { + public void deleteRoomTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -302,32 +302,32 @@ void deleteRoomTest() throws Exception { client.deleteRoom(name); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteRoomRequest actualRequest = ((DeleteRoomRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteRoomExceptionTest() throws Exception { + public void deleteRoomExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { RoomName name = RoomName.of("[ROOM]"); client.deleteRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteRoomTest2() throws Exception { + public void deleteRoomTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -336,32 +336,32 @@ void deleteRoomTest2() throws Exception { client.deleteRoom(name); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteRoomRequest actualRequest = ((DeleteRoomRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteRoomExceptionTest2() throws Exception { + public void deleteRoomExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.deleteRoom(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listRoomsTest() throws Exception { + public void listRoomsTest() throws Exception { Room responsesElement = Room.newBuilder().build(); ListRoomsResponse expectedResponse = ListRoomsResponse.newBuilder() @@ -380,23 +380,23 @@ void listRoomsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getRoomsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListRoomsRequest actualRequest = ((ListRoomsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listRoomsExceptionTest() throws Exception { + public void listRoomsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -407,14 +407,14 @@ void listRoomsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listRooms(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest() throws Exception { + public void createBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -431,23 +431,23 @@ void createBlurbTest() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assert.assertEquals(image, actualRequest.getBlurb().getImage()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest() throws Exception { + public void createBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -456,14 +456,14 @@ void createBlurbExceptionTest() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest2() throws Exception { + public void createBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -480,23 +480,23 @@ void createBlurbTest2() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assertions.assertEquals(text, actualRequest.getBlurb().getText()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assert.assertEquals(text, actualRequest.getBlurb().getText()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest2() throws Exception { + public void createBlurbExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -505,14 +505,14 @@ void createBlurbExceptionTest2() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest3() throws Exception { + public void createBlurbTest3() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -529,23 +529,23 @@ void createBlurbTest3() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); - Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user, actualRequest.getBlurb().getUser()); + Assert.assertEquals(image, actualRequest.getBlurb().getImage()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest3() throws Exception { + public void createBlurbExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -554,14 +554,14 @@ void createBlurbExceptionTest3() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest4() throws Exception { + public void createBlurbTest4() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -578,23 +578,23 @@ void createBlurbTest4() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); - Assertions.assertEquals(text, actualRequest.getBlurb().getText()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user, actualRequest.getBlurb().getUser()); + Assert.assertEquals(text, actualRequest.getBlurb().getText()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest4() throws Exception { + public void createBlurbExceptionTest4() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -603,14 +603,14 @@ void createBlurbExceptionTest4() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest5() throws Exception { + public void createBlurbTest5() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -627,23 +627,23 @@ void createBlurbTest5() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assert.assertEquals(image, actualRequest.getBlurb().getImage()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest5() throws Exception { + public void createBlurbExceptionTest5() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -652,14 +652,14 @@ void createBlurbExceptionTest5() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest6() throws Exception { + public void createBlurbTest6() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -676,23 +676,23 @@ void createBlurbTest6() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assertions.assertEquals(text, actualRequest.getBlurb().getText()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assert.assertEquals(text, actualRequest.getBlurb().getText()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest6() throws Exception { + public void createBlurbExceptionTest6() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -701,14 +701,14 @@ void createBlurbExceptionTest6() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest7() throws Exception { + public void createBlurbTest7() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -725,23 +725,23 @@ void createBlurbTest7() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); - Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user, actualRequest.getBlurb().getUser()); + Assert.assertEquals(image, actualRequest.getBlurb().getImage()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest7() throws Exception { + public void createBlurbExceptionTest7() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -750,14 +750,14 @@ void createBlurbExceptionTest7() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest8() throws Exception { + public void createBlurbTest8() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -774,23 +774,23 @@ void createBlurbTest8() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); - Assertions.assertEquals(text, actualRequest.getBlurb().getText()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(user, actualRequest.getBlurb().getUser()); + Assert.assertEquals(text, actualRequest.getBlurb().getText()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest8() throws Exception { + public void createBlurbExceptionTest8() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -799,14 +799,14 @@ void createBlurbExceptionTest8() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest9() throws Exception { + public void createBlurbTest9() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -823,23 +823,23 @@ void createBlurbTest9() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent, actualRequest.getParent()); - Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); - Assertions.assertTrue( + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assert.assertEquals(image, actualRequest.getBlurb().getImage()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest9() throws Exception { + public void createBlurbExceptionTest9() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -848,14 +848,14 @@ void createBlurbExceptionTest9() throws Exception { UserName user = UserName.of("[USER]"); ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest10() throws Exception { + public void createBlurbTest10() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -872,23 +872,23 @@ void createBlurbTest10() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent, actualRequest.getParent()); - Assertions.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); - Assertions.assertEquals(text, actualRequest.getBlurb().getText()); - Assertions.assertTrue( + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(user.toString(), actualRequest.getBlurb().getUser()); + Assert.assertEquals(text, actualRequest.getBlurb().getText()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest10() throws Exception { + public void createBlurbExceptionTest10() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -897,14 +897,14 @@ void createBlurbExceptionTest10() throws Exception { UserName user = UserName.of("[USER]"); String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest11() throws Exception { + public void createBlurbTest11() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -921,23 +921,23 @@ void createBlurbTest11() throws Exception { ByteString image = ByteString.EMPTY; Blurb actualResponse = client.createBlurb(parent, user, image); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent, actualRequest.getParent()); - Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); - Assertions.assertEquals(image, actualRequest.getBlurb().getImage()); - Assertions.assertTrue( + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(user, actualRequest.getBlurb().getUser()); + Assert.assertEquals(image, actualRequest.getBlurb().getImage()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest11() throws Exception { + public void createBlurbExceptionTest11() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -946,14 +946,14 @@ void createBlurbExceptionTest11() throws Exception { String user = "user3599307"; ByteString image = ByteString.EMPTY; client.createBlurb(parent, user, image); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createBlurbTest12() throws Exception { + public void createBlurbTest12() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName( @@ -970,23 +970,23 @@ void createBlurbTest12() throws Exception { String text = "text3556653"; Blurb actualResponse = client.createBlurb(parent, user, text); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateBlurbRequest actualRequest = ((CreateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(parent, actualRequest.getParent()); - Assertions.assertEquals(user, actualRequest.getBlurb().getUser()); - Assertions.assertEquals(text, actualRequest.getBlurb().getText()); - Assertions.assertTrue( + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(user, actualRequest.getBlurb().getUser()); + Assert.assertEquals(text, actualRequest.getBlurb().getText()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createBlurbExceptionTest12() throws Exception { + public void createBlurbExceptionTest12() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -995,14 +995,14 @@ void createBlurbExceptionTest12() throws Exception { String user = "user3599307"; String text = "text3556653"; client.createBlurb(parent, user, text); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getBlurbTest() throws Exception { + public void getBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1015,35 +1015,35 @@ void getBlurbTest() throws Exception { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); Blurb actualResponse = client.getBlurb(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetBlurbRequest actualRequest = ((GetBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getBlurbExceptionTest() throws Exception { + public void getBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.getBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getBlurbTest2() throws Exception { + public void getBlurbTest2() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1056,35 +1056,35 @@ void getBlurbTest2() throws Exception { String name = "name3373707"; Blurb actualResponse = client.getBlurb(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetBlurbRequest actualRequest = ((GetBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getBlurbExceptionTest2() throws Exception { + public void getBlurbExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.getBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void updateBlurbTest() throws Exception { + public void updateBlurbTest() throws Exception { Blurb expectedResponse = Blurb.newBuilder() .setName(BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]").toString()) @@ -1101,22 +1101,22 @@ void updateBlurbTest() throws Exception { .build(); Blurb actualResponse = client.updateBlurb(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); UpdateBlurbRequest actualRequest = ((UpdateBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getBlurb(), actualRequest.getBlurb()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getBlurb(), actualRequest.getBlurb()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void updateBlurbExceptionTest() throws Exception { + public void updateBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1127,14 +1127,14 @@ void updateBlurbExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.updateBlurb(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteBlurbTest() throws Exception { + public void deleteBlurbTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -1143,32 +1143,32 @@ void deleteBlurbTest() throws Exception { client.deleteBlurb(name); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteBlurbRequest actualRequest = ((DeleteBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteBlurbExceptionTest() throws Exception { + public void deleteBlurbExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { BlurbName name = BlurbName.ofRoomBlurbName("[ROOM]", "[BLURB]"); client.deleteBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteBlurbTest2() throws Exception { + public void deleteBlurbTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockMessaging.addResponse(expectedResponse); @@ -1177,32 +1177,32 @@ void deleteBlurbTest2() throws Exception { client.deleteBlurb(name); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteBlurbRequest actualRequest = ((DeleteBlurbRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteBlurbExceptionTest2() throws Exception { + public void deleteBlurbExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String name = "name3373707"; client.deleteBlurb(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listBlurbsTest() throws Exception { + public void listBlurbsTest() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1217,36 +1217,36 @@ void listBlurbsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListBlurbsRequest actualRequest = ((ListBlurbsRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listBlurbsExceptionTest() throws Exception { + public void listBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { ProfileName parent = ProfileName.of("[USER]"); client.listBlurbs(parent); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listBlurbsTest2() throws Exception { + public void listBlurbsTest2() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1261,36 +1261,36 @@ void listBlurbsTest2() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListBlurbsRequest actualRequest = ((ListBlurbsRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listBlurbsExceptionTest2() throws Exception { + public void listBlurbsExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { RoomName parent = RoomName.of("[ROOM]"); client.listBlurbs(parent); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listBlurbsTest3() throws Exception { + public void listBlurbsTest3() throws Exception { Blurb responsesElement = Blurb.newBuilder().build(); ListBlurbsResponse expectedResponse = ListBlurbsResponse.newBuilder() @@ -1305,36 +1305,36 @@ void listBlurbsTest3() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBlurbsList().get(0), resources.get(0)); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListBlurbsRequest actualRequest = ((ListBlurbsRequest) actualRequests.get(0)); - Assertions.assertEquals(parent, actualRequest.getParent()); - Assertions.assertTrue( + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listBlurbsExceptionTest3() throws Exception { + public void listBlurbsExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); try { String parent = "parent-995424086"; client.listBlurbs(parent); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void searchBlurbsTest() throws Exception { + public void searchBlurbsTest() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1352,22 +1352,22 @@ void searchBlurbsTest() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SearchBlurbsRequest actualRequest = ((SearchBlurbsRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(query, actualRequest.getQuery()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void searchBlurbsExceptionTest() throws Exception { + public void searchBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1375,17 +1375,16 @@ void searchBlurbsExceptionTest() throws Exception { ProfileName parent = ProfileName.of("[USER]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { - Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void searchBlurbsTest2() throws Exception { + public void searchBlurbsTest2() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1403,22 +1402,22 @@ void searchBlurbsTest2() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SearchBlurbsRequest actualRequest = ((SearchBlurbsRequest) actualRequests.get(0)); - Assertions.assertEquals(parent.toString(), actualRequest.getParent()); - Assertions.assertEquals(query, actualRequest.getQuery()); - Assertions.assertTrue( + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void searchBlurbsExceptionTest2() throws Exception { + public void searchBlurbsExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1426,17 +1425,16 @@ void searchBlurbsExceptionTest2() throws Exception { RoomName parent = RoomName.of("[ROOM]"); String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { - Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void searchBlurbsTest3() throws Exception { + public void searchBlurbsTest3() throws Exception { SearchBlurbsResponse expectedResponse = SearchBlurbsResponse.newBuilder() .addAllBlurbs(new ArrayList()) @@ -1454,22 +1452,22 @@ void searchBlurbsTest3() throws Exception { String query = "query107944136"; SearchBlurbsResponse actualResponse = client.searchBlurbsAsync(parent, query).get(); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockMessaging.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SearchBlurbsRequest actualRequest = ((SearchBlurbsRequest) actualRequests.get(0)); - Assertions.assertEquals(parent, actualRequest.getParent()); - Assertions.assertEquals(query, actualRequest.getQuery()); - Assertions.assertTrue( + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(query, actualRequest.getQuery()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void searchBlurbsExceptionTest3() throws Exception { + public void searchBlurbsExceptionTest3() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); @@ -1477,17 +1475,16 @@ void searchBlurbsExceptionTest3() throws Exception { String parent = "parent-995424086"; String query = "query107944136"; client.searchBlurbsAsync(parent, query).get(); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (ExecutionException e) { - Assertions.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void streamBlurbsTest() throws Exception { + public void streamBlurbsTest() throws Exception { StreamBlurbsResponse expectedResponse = StreamBlurbsResponse.newBuilder().setBlurb(Blurb.newBuilder().build()).build(); mockMessaging.addResponse(expectedResponse); @@ -1504,12 +1501,12 @@ void streamBlurbsTest() throws Exception { callable.serverStreamingCall(request, responseObserver); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void streamBlurbsExceptionTest() throws Exception { + public void streamBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); StreamBlurbsRequest request = @@ -1526,17 +1523,16 @@ void streamBlurbsExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void sendBlurbsTest() throws Exception { + public void sendBlurbsTest() throws Exception { SendBlurbsResponse expectedResponse = SendBlurbsResponse.newBuilder().addAllNames(new ArrayList()).build(); mockMessaging.addResponse(expectedResponse); @@ -1557,12 +1553,12 @@ void sendBlurbsTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void sendBlurbsExceptionTest() throws Exception { + public void sendBlurbsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); CreateBlurbRequest request = @@ -1582,17 +1578,16 @@ void sendBlurbsExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void connectTest() throws Exception { + public void connectTest() throws Exception { StreamBlurbsResponse expectedResponse = StreamBlurbsResponse.newBuilder().setBlurb(Blurb.newBuilder().build()).build(); mockMessaging.addResponse(expectedResponse); @@ -1608,12 +1603,12 @@ void connectTest() throws Exception { requestObserver.onCompleted(); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void connectExceptionTest() throws Exception { + public void connectExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockMessaging.addException(exception); ConnectRequest request = ConnectRequest.newBuilder().build(); @@ -1628,17 +1623,16 @@ void connectExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -1659,25 +1653,25 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -1690,14 +1684,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -1711,35 +1705,35 @@ void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1757,23 +1751,23 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1785,14 +1779,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -1809,22 +1803,22 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1835,14 +1829,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -1854,22 +1848,22 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -1880,7 +1874,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java index 7a1c5eedd0..e95fda6114 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientHttpJsonTest.java @@ -51,19 +51,19 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class SequenceServiceClientHttpJsonTest { +public class SequenceServiceClientHttpJsonTest { private static MockHttpService mockService; private static SequenceServiceClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -80,21 +80,21 @@ public static void startStaticServer() throws IOException { client = SequenceServiceClient.create(settings); } - @AfterAll + @AfterClass public static void stopServer() { client.close(); } - @BeforeEach - void setUp() {} + @Before + public void setUp() {} - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { mockService.reset(); } @Test - void createSequenceTest() throws Exception { + public void createSequenceTest() throws Exception { Sequence expectedResponse = Sequence.newBuilder() .setName(SequenceName.of("[SEQUENCE]").toString()) @@ -105,10 +105,10 @@ void createSequenceTest() throws Exception { Sequence sequence = Sequence.newBuilder().build(); Sequence actualResponse = client.createSequence(sequence); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -116,14 +116,14 @@ void createSequenceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createSequenceExceptionTest() throws Exception { + public void createSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -132,14 +132,14 @@ void createSequenceExceptionTest() throws Exception { try { Sequence sequence = Sequence.newBuilder().build(); client.createSequence(sequence); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createStreamingSequenceTest() throws Exception { + public void createStreamingSequenceTest() throws Exception { StreamingSequence expectedResponse = StreamingSequence.newBuilder() .setName(StreamingSequenceName.of("[STREAMING_SEQUENCE]").toString()) @@ -151,10 +151,10 @@ void createStreamingSequenceTest() throws Exception { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); StreamingSequence actualResponse = client.createStreamingSequence(streamingSequence); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -162,14 +162,14 @@ void createStreamingSequenceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createStreamingSequenceExceptionTest() throws Exception { + public void createStreamingSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -178,14 +178,14 @@ void createStreamingSequenceExceptionTest() throws Exception { try { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); client.createStreamingSequence(streamingSequence); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getSequenceReportTest() throws Exception { + public void getSequenceReportTest() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -196,10 +196,10 @@ void getSequenceReportTest() throws Exception { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); SequenceReport actualResponse = client.getSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -207,14 +207,14 @@ void getSequenceReportTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getSequenceReportExceptionTest() throws Exception { + public void getSequenceReportExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -223,14 +223,14 @@ void getSequenceReportExceptionTest() throws Exception { try { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); client.getSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getSequenceReportTest2() throws Exception { + public void getSequenceReportTest2() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -241,10 +241,10 @@ void getSequenceReportTest2() throws Exception { String name = "sequences/sequence-5566/sequenceReport"; SequenceReport actualResponse = client.getSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -252,14 +252,14 @@ void getSequenceReportTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getSequenceReportExceptionTest2() throws Exception { + public void getSequenceReportExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -268,14 +268,14 @@ void getSequenceReportExceptionTest2() throws Exception { try { String name = "sequences/sequence-5566/sequenceReport"; client.getSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getStreamingSequenceReportTest() throws Exception { + public void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -286,10 +286,10 @@ void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -297,14 +297,14 @@ void getStreamingSequenceReportTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getStreamingSequenceReportExceptionTest() throws Exception { + public void getStreamingSequenceReportExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -313,14 +313,14 @@ void getStreamingSequenceReportExceptionTest() throws Exception { try { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); client.getStreamingSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getStreamingSequenceReportTest2() throws Exception { + public void getStreamingSequenceReportTest2() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -331,10 +331,10 @@ void getStreamingSequenceReportTest2() throws Exception { String name = "streamingSequences/streamingSequence-962/streamingSequenceReport"; StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -342,14 +342,14 @@ void getStreamingSequenceReportTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getStreamingSequenceReportExceptionTest2() throws Exception { + public void getStreamingSequenceReportExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -358,14 +358,14 @@ void getStreamingSequenceReportExceptionTest2() throws Exception { try { String name = "streamingSequences/streamingSequence-962/streamingSequenceReport"; client.getStreamingSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void attemptSequenceTest() throws Exception { + public void attemptSequenceTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -374,7 +374,7 @@ void attemptSequenceTest() throws Exception { client.attemptSequence(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -382,14 +382,14 @@ void attemptSequenceTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void attemptSequenceExceptionTest() throws Exception { + public void attemptSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -398,14 +398,14 @@ void attemptSequenceExceptionTest() throws Exception { try { SequenceName name = SequenceName.of("[SEQUENCE]"); client.attemptSequence(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void attemptSequenceTest2() throws Exception { + public void attemptSequenceTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -414,7 +414,7 @@ void attemptSequenceTest2() throws Exception { client.attemptSequence(name); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -422,14 +422,14 @@ void attemptSequenceTest2() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void attemptSequenceExceptionTest2() throws Exception { + public void attemptSequenceExceptionTest2() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -438,17 +438,17 @@ void attemptSequenceExceptionTest2() throws Exception { try { String name = "sequences/sequence-9950"; client.attemptSequence(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void attemptStreamingSequenceTest() throws Exception {} + public void attemptStreamingSequenceTest() throws Exception {} @Test - void attemptStreamingSequenceExceptionTest() throws Exception { + public void attemptStreamingSequenceExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -456,7 +456,7 @@ void attemptStreamingSequenceExceptionTest() throws Exception { } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -477,11 +477,11 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -489,14 +489,14 @@ void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -511,14 +511,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -535,10 +535,10 @@ void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -546,14 +546,14 @@ void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -565,14 +565,14 @@ void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -590,10 +590,10 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -601,14 +601,14 @@ void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -622,14 +622,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -646,10 +646,10 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -657,14 +657,14 @@ void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -677,14 +677,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -696,10 +696,10 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -707,14 +707,14 @@ void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -727,7 +727,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java index 7c2a612715..bd5b067014 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/SequenceServiceClientTest.java @@ -55,15 +55,15 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class SequenceServiceClientTest { +public class SequenceServiceClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; private static MockSequenceService mockSequenceService; @@ -71,7 +71,7 @@ class SequenceServiceClientTest { private LocalChannelProvider channelProvider; private SequenceServiceClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() { mockSequenceService = new MockSequenceService(); mockLocations = new MockLocations(); @@ -83,13 +83,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterAll + @AfterClass public static void stopServer() { mockServiceHelper.stop(); } - @BeforeEach - void setUp() throws IOException { + @Before + public void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); SequenceServiceSettings settings = @@ -100,13 +100,13 @@ void setUp() throws IOException { client = SequenceServiceClient.create(settings); } - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { client.close(); } @Test - void createSequenceTest() throws Exception { + public void createSequenceTest() throws Exception { Sequence expectedResponse = Sequence.newBuilder() .setName(SequenceName.of("[SEQUENCE]").toString()) @@ -117,35 +117,35 @@ void createSequenceTest() throws Exception { Sequence sequence = Sequence.newBuilder().build(); Sequence actualResponse = client.createSequence(sequence); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateSequenceRequest actualRequest = ((CreateSequenceRequest) actualRequests.get(0)); - Assertions.assertEquals(sequence, actualRequest.getSequence()); - Assertions.assertTrue( + Assert.assertEquals(sequence, actualRequest.getSequence()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createSequenceExceptionTest() throws Exception { + public void createSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { Sequence sequence = Sequence.newBuilder().build(); client.createSequence(sequence); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void createStreamingSequenceTest() throws Exception { + public void createStreamingSequenceTest() throws Exception { StreamingSequence expectedResponse = StreamingSequence.newBuilder() .setName(StreamingSequenceName.of("[STREAMING_SEQUENCE]").toString()) @@ -157,36 +157,36 @@ void createStreamingSequenceTest() throws Exception { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); StreamingSequence actualResponse = client.createStreamingSequence(streamingSequence); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateStreamingSequenceRequest actualRequest = ((CreateStreamingSequenceRequest) actualRequests.get(0)); - Assertions.assertEquals(streamingSequence, actualRequest.getStreamingSequence()); - Assertions.assertTrue( + Assert.assertEquals(streamingSequence, actualRequest.getStreamingSequence()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createStreamingSequenceExceptionTest() throws Exception { + public void createStreamingSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { StreamingSequence streamingSequence = StreamingSequence.newBuilder().build(); client.createStreamingSequence(streamingSequence); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getSequenceReportTest() throws Exception { + public void getSequenceReportTest() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -197,35 +197,35 @@ void getSequenceReportTest() throws Exception { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); SequenceReport actualResponse = client.getSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetSequenceReportRequest actualRequest = ((GetSequenceReportRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getSequenceReportExceptionTest() throws Exception { + public void getSequenceReportExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { SequenceReportName name = SequenceReportName.of("[SEQUENCE]"); client.getSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getSequenceReportTest2() throws Exception { + public void getSequenceReportTest2() throws Exception { SequenceReport expectedResponse = SequenceReport.newBuilder() .setName(SequenceReportName.of("[SEQUENCE]").toString()) @@ -236,35 +236,35 @@ void getSequenceReportTest2() throws Exception { String name = "name3373707"; SequenceReport actualResponse = client.getSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetSequenceReportRequest actualRequest = ((GetSequenceReportRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getSequenceReportExceptionTest2() throws Exception { + public void getSequenceReportExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { String name = "name3373707"; client.getSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getStreamingSequenceReportTest() throws Exception { + public void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -275,36 +275,36 @@ void getStreamingSequenceReportTest() throws Exception { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetStreamingSequenceReportRequest actualRequest = ((GetStreamingSequenceReportRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getStreamingSequenceReportExceptionTest() throws Exception { + public void getStreamingSequenceReportExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { StreamingSequenceReportName name = StreamingSequenceReportName.of("[STREAMING_SEQUENCE]"); client.getStreamingSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getStreamingSequenceReportTest2() throws Exception { + public void getStreamingSequenceReportTest2() throws Exception { StreamingSequenceReport expectedResponse = StreamingSequenceReport.newBuilder() .setName(StreamingSequenceReportName.of("[STREAMING_SEQUENCE]").toString()) @@ -315,36 +315,36 @@ void getStreamingSequenceReportTest2() throws Exception { String name = "name3373707"; StreamingSequenceReport actualResponse = client.getStreamingSequenceReport(name); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetStreamingSequenceReportRequest actualRequest = ((GetStreamingSequenceReportRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getStreamingSequenceReportExceptionTest2() throws Exception { + public void getStreamingSequenceReportExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { String name = "name3373707"; client.getStreamingSequenceReport(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void attemptSequenceTest() throws Exception { + public void attemptSequenceTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSequenceService.addResponse(expectedResponse); @@ -353,32 +353,32 @@ void attemptSequenceTest() throws Exception { client.attemptSequence(name); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); AttemptSequenceRequest actualRequest = ((AttemptSequenceRequest) actualRequests.get(0)); - Assertions.assertEquals(name.toString(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void attemptSequenceExceptionTest() throws Exception { + public void attemptSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { SequenceName name = SequenceName.of("[SEQUENCE]"); client.attemptSequence(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void attemptSequenceTest2() throws Exception { + public void attemptSequenceTest2() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockSequenceService.addResponse(expectedResponse); @@ -387,32 +387,32 @@ void attemptSequenceTest2() throws Exception { client.attemptSequence(name); List actualRequests = mockSequenceService.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); AttemptSequenceRequest actualRequest = ((AttemptSequenceRequest) actualRequests.get(0)); - Assertions.assertEquals(name, actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void attemptSequenceExceptionTest2() throws Exception { + public void attemptSequenceExceptionTest2() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); try { String name = "name3373707"; client.attemptSequence(name); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void attemptStreamingSequenceTest() throws Exception { + public void attemptStreamingSequenceTest() throws Exception { AttemptStreamingSequenceResponse expectedResponse = AttemptStreamingSequenceResponse.newBuilder().setContent("content951530617").build(); mockSequenceService.addResponse(expectedResponse); @@ -429,12 +429,12 @@ void attemptStreamingSequenceTest() throws Exception { callable.serverStreamingCall(request, responseObserver); List actualResponses = responseObserver.future().get(); - Assertions.assertEquals(1, actualResponses.size()); - Assertions.assertEquals(expectedResponse, actualResponses.get(0)); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); } @Test - void attemptStreamingSequenceExceptionTest() throws Exception { + public void attemptStreamingSequenceExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockSequenceService.addException(exception); AttemptStreamingSequenceRequest request = @@ -451,17 +451,16 @@ void attemptStreamingSequenceExceptionTest() throws Exception { try { List actualResponses = responseObserver.future().get(); - Assertions.fail("No exception thrown"); + Assert.fail("No exception thrown"); } catch (ExecutionException e) { - Assertions.assertTrue(e.getCause() instanceof InvalidArgumentException); + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assertions.assertEquals( - StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -482,25 +481,25 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -513,14 +512,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -534,35 +533,35 @@ void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -580,23 +579,23 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -608,14 +607,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -632,22 +631,22 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -658,14 +657,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -677,22 +676,22 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -703,7 +702,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java index ae339c8171..9c49a43893 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientHttpJsonTest.java @@ -53,19 +53,19 @@ import java.util.HashMap; import java.util.List; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class TestingClientHttpJsonTest { +public class TestingClientHttpJsonTest { private static MockHttpService mockService; private static TestingClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() throws IOException { mockService = new MockHttpService( @@ -81,21 +81,21 @@ public static void startStaticServer() throws IOException { client = TestingClient.create(settings); } - @AfterAll + @AfterClass public static void stopServer() { client.close(); } - @BeforeEach - void setUp() {} + @Before + public void setUp() {} - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { mockService.reset(); } @Test - void createSessionTest() throws Exception { + public void createSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockService.addResponse(expectedResponse); @@ -104,10 +104,10 @@ void createSessionTest() throws Exception { CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); Session actualResponse = client.createSession(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -115,14 +115,14 @@ void createSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void createSessionExceptionTest() throws Exception { + public void createSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -132,14 +132,14 @@ void createSessionExceptionTest() throws Exception { CreateSessionRequest request = CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); client.createSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getSessionTest() throws Exception { + public void getSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockService.addResponse(expectedResponse); @@ -148,10 +148,10 @@ void getSessionTest() throws Exception { GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); Session actualResponse = client.getSession(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -159,14 +159,14 @@ void getSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getSessionExceptionTest() throws Exception { + public void getSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -176,14 +176,14 @@ void getSessionExceptionTest() throws Exception { GetSessionRequest request = GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.getSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listSessionsTest() throws Exception { + public void listSessionsTest() throws Exception { Session responsesElement = Session.newBuilder().build(); ListSessionsResponse expectedResponse = ListSessionsResponse.newBuilder() @@ -202,11 +202,11 @@ void listSessionsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -214,14 +214,14 @@ void listSessionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listSessionsExceptionTest() throws Exception { + public void listSessionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -234,14 +234,14 @@ void listSessionsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listSessions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteSessionTest() throws Exception { + public void deleteSessionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -251,7 +251,7 @@ void deleteSessionTest() throws Exception { client.deleteSession(request); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -259,14 +259,14 @@ void deleteSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteSessionExceptionTest() throws Exception { + public void deleteSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -276,14 +276,14 @@ void deleteSessionExceptionTest() throws Exception { DeleteSessionRequest request = DeleteSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.deleteSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void reportSessionTest() throws Exception { + public void reportSessionTest() throws Exception { ReportSessionResponse expectedResponse = ReportSessionResponse.newBuilder().addAllTestRuns(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -292,10 +292,10 @@ void reportSessionTest() throws Exception { ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); ReportSessionResponse actualResponse = client.reportSession(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -303,14 +303,14 @@ void reportSessionTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void reportSessionExceptionTest() throws Exception { + public void reportSessionExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -320,14 +320,14 @@ void reportSessionExceptionTest() throws Exception { ReportSessionRequest request = ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.reportSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listTestsTest() throws Exception { + public void listTestsTest() throws Exception { com.google.showcase.v1beta1.Test responsesElement = com.google.showcase.v1beta1.Test.newBuilder().build(); ListTestsResponse expectedResponse = @@ -349,11 +349,11 @@ void listTestsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -361,14 +361,14 @@ void listTestsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listTestsExceptionTest() throws Exception { + public void listTestsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -382,14 +382,14 @@ void listTestsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listTests(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteTestTest() throws Exception { + public void deleteTestTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockService.addResponse(expectedResponse); @@ -401,7 +401,7 @@ void deleteTestTest() throws Exception { client.deleteTest(request); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -409,14 +409,14 @@ void deleteTestTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void deleteTestExceptionTest() throws Exception { + public void deleteTestExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -428,14 +428,14 @@ void deleteTestExceptionTest() throws Exception { .setName(TestName.of("[SESSION]", "[TEST]").toString()) .build(); client.deleteTest(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void verifyTestTest() throws Exception { + public void verifyTestTest() throws Exception { VerifyTestResponse expectedResponse = VerifyTestResponse.newBuilder().setIssue(Issue.newBuilder().build()).build(); mockService.addResponse(expectedResponse); @@ -448,10 +448,10 @@ void verifyTestTest() throws Exception { .build(); VerifyTestResponse actualResponse = client.verifyTest(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -459,14 +459,14 @@ void verifyTestTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void verifyTestExceptionTest() throws Exception { + public void verifyTestExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -480,14 +480,14 @@ void verifyTestExceptionTest() throws Exception { .addAllAnswers(new ArrayList()) .build(); client.verifyTest(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -508,11 +508,11 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -520,14 +520,14 @@ void listLocationsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -542,14 +542,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -566,10 +566,10 @@ void getLocationTest() throws Exception { .build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -577,14 +577,14 @@ void getLocationTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -596,14 +596,14 @@ void getLocationExceptionTest() throws Exception { .setName("projects/project-9062/locations/location-9062") .build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -621,10 +621,10 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -632,14 +632,14 @@ void setIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -653,14 +653,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -677,10 +677,10 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -688,14 +688,14 @@ void getIamPolicyTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -708,14 +708,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockService.addResponse(expectedResponse); @@ -727,10 +727,10 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockService.getRequestPaths(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); String apiClientHeaderKey = mockService @@ -738,14 +738,14 @@ void testIamPermissionsTest() throws Exception { .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) .iterator() .next(); - Assertions.assertTrue( + Assert.assertTrue( GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() .matcher(apiClientHeaderKey) .matches()); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { ApiException exception = ApiExceptionFactory.createException( new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); @@ -758,7 +758,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java index dd29bd26d4..81ca82c304 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/TestingClientTest.java @@ -53,15 +53,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Generated; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; @Generated("by gapic-generator-java") -class TestingClientTest { +public class TestingClientTest { private static MockIAMPolicy mockIAMPolicy; private static MockLocations mockLocations; private static MockServiceHelper mockServiceHelper; @@ -69,7 +69,7 @@ class TestingClientTest { private LocalChannelProvider channelProvider; private TestingClient client; - @BeforeAll + @BeforeClass public static void startStaticServer() { mockTesting = new MockTesting(); mockLocations = new MockLocations(); @@ -81,13 +81,13 @@ public static void startStaticServer() { mockServiceHelper.start(); } - @AfterAll + @AfterClass public static void stopServer() { mockServiceHelper.stop(); } - @BeforeEach - void setUp() throws IOException { + @Before + public void setUp() throws IOException { mockServiceHelper.reset(); channelProvider = mockServiceHelper.createChannelProvider(); TestingSettings settings = @@ -98,13 +98,13 @@ void setUp() throws IOException { client = TestingClient.create(settings); } - @AfterEach - void tearDown() throws Exception { + @After + public void tearDown() throws Exception { client.close(); } @Test - void createSessionTest() throws Exception { + public void createSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockTesting.addResponse(expectedResponse); @@ -113,21 +113,21 @@ void createSessionTest() throws Exception { CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); Session actualResponse = client.createSession(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); CreateSessionRequest actualRequest = ((CreateSessionRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getSession(), actualRequest.getSession()); - Assertions.assertTrue( + Assert.assertEquals(request.getSession(), actualRequest.getSession()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void createSessionExceptionTest() throws Exception { + public void createSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -135,14 +135,14 @@ void createSessionExceptionTest() throws Exception { CreateSessionRequest request = CreateSessionRequest.newBuilder().setSession(Session.newBuilder().build()).build(); client.createSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getSessionTest() throws Exception { + public void getSessionTest() throws Exception { Session expectedResponse = Session.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); mockTesting.addResponse(expectedResponse); @@ -151,21 +151,21 @@ void getSessionTest() throws Exception { GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); Session actualResponse = client.getSession(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetSessionRequest actualRequest = ((GetSessionRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getSessionExceptionTest() throws Exception { + public void getSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -173,14 +173,14 @@ void getSessionExceptionTest() throws Exception { GetSessionRequest request = GetSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.getSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listSessionsTest() throws Exception { + public void listSessionsTest() throws Exception { Session responsesElement = Session.newBuilder().build(); ListSessionsResponse expectedResponse = ListSessionsResponse.newBuilder() @@ -199,23 +199,23 @@ void listSessionsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSessionsList().get(0), resources.get(0)); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListSessionsRequest actualRequest = ((ListSessionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listSessionsExceptionTest() throws Exception { + public void listSessionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -226,14 +226,14 @@ void listSessionsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listSessions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteSessionTest() throws Exception { + public void deleteSessionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTesting.addResponse(expectedResponse); @@ -243,18 +243,18 @@ void deleteSessionTest() throws Exception { client.deleteSession(request); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteSessionRequest actualRequest = ((DeleteSessionRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteSessionExceptionTest() throws Exception { + public void deleteSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -262,14 +262,14 @@ void deleteSessionExceptionTest() throws Exception { DeleteSessionRequest request = DeleteSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.deleteSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void reportSessionTest() throws Exception { + public void reportSessionTest() throws Exception { ReportSessionResponse expectedResponse = ReportSessionResponse.newBuilder().addAllTestRuns(new ArrayList()).build(); mockTesting.addResponse(expectedResponse); @@ -278,21 +278,21 @@ void reportSessionTest() throws Exception { ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); ReportSessionResponse actualResponse = client.reportSession(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ReportSessionRequest actualRequest = ((ReportSessionRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void reportSessionExceptionTest() throws Exception { + public void reportSessionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -300,14 +300,14 @@ void reportSessionExceptionTest() throws Exception { ReportSessionRequest request = ReportSessionRequest.newBuilder().setName(SessionName.of("[SESSION]").toString()).build(); client.reportSession(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listTestsTest() throws Exception { + public void listTestsTest() throws Exception { com.google.showcase.v1beta1.Test responsesElement = com.google.showcase.v1beta1.Test.newBuilder().build(); ListTestsResponse expectedResponse = @@ -329,24 +329,24 @@ void listTestsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTestsList().get(0), resources.get(0)); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListTestsRequest actualRequest = ((ListTestsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getParent(), actualRequest.getParent()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listTestsExceptionTest() throws Exception { + public void listTestsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -358,14 +358,14 @@ void listTestsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listTests(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void deleteTestTest() throws Exception { + public void deleteTestTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockTesting.addResponse(expectedResponse); @@ -377,18 +377,18 @@ void deleteTestTest() throws Exception { client.deleteTest(request); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); DeleteTestRequest actualRequest = ((DeleteTestRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void deleteTestExceptionTest() throws Exception { + public void deleteTestExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -398,14 +398,14 @@ void deleteTestExceptionTest() throws Exception { .setName(TestName.of("[SESSION]", "[TEST]").toString()) .build(); client.deleteTest(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void verifyTestTest() throws Exception { + public void verifyTestTest() throws Exception { VerifyTestResponse expectedResponse = VerifyTestResponse.newBuilder().setIssue(Issue.newBuilder().build()).build(); mockTesting.addResponse(expectedResponse); @@ -418,23 +418,23 @@ void verifyTestTest() throws Exception { .build(); VerifyTestResponse actualResponse = client.verifyTest(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockTesting.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); VerifyTestRequest actualRequest = ((VerifyTestRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getAnswer(), actualRequest.getAnswer()); - Assertions.assertEquals(request.getAnswersList(), actualRequest.getAnswersList()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getAnswer(), actualRequest.getAnswer()); + Assert.assertEquals(request.getAnswersList(), actualRequest.getAnswersList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void verifyTestExceptionTest() throws Exception { + public void verifyTestExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockTesting.addException(exception); @@ -446,14 +446,14 @@ void verifyTestExceptionTest() throws Exception { .addAllAnswers(new ArrayList()) .build(); client.verifyTest(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void listLocationsTest() throws Exception { + public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); ListLocationsResponse expectedResponse = ListLocationsResponse.newBuilder() @@ -474,25 +474,25 @@ void listLocationsTest() throws Exception { List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assertions.assertEquals(1, resources.size()); - Assertions.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assertions.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assertions.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void listLocationsExceptionTest() throws Exception { + public void listLocationsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); @@ -505,14 +505,14 @@ void listLocationsExceptionTest() throws Exception { .setPageToken("pageToken873572522") .build(); client.listLocations(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getLocationTest() throws Exception { + public void getLocationTest() throws Exception { Location expectedResponse = Location.newBuilder() .setName("name3373707") @@ -526,35 +526,35 @@ void getLocationTest() throws Exception { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location actualResponse = client.getLocation(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockLocations.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getName(), actualRequest.getName()); - Assertions.assertTrue( + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getLocationExceptionTest() throws Exception { + public void getLocationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockLocations.addException(exception); try { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); client.getLocation(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void setIamPolicyTest() throws Exception { + public void setIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -572,23 +572,23 @@ void setIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.setIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPolicy(), actualRequest.getPolicy()); - Assertions.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void setIamPolicyExceptionTest() throws Exception { + public void setIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -600,14 +600,14 @@ void setIamPolicyExceptionTest() throws Exception { .setUpdateMask(FieldMask.newBuilder().build()) .build(); client.setIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void getIamPolicyTest() throws Exception { + public void getIamPolicyTest() throws Exception { Policy expectedResponse = Policy.newBuilder() .setVersion(351608024) @@ -624,22 +624,22 @@ void getIamPolicyTest() throws Exception { .build(); Policy actualResponse = client.getIamPolicy(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getOptions(), actualRequest.getOptions()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void getIamPolicyExceptionTest() throws Exception { + public void getIamPolicyExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -650,14 +650,14 @@ void getIamPolicyExceptionTest() throws Exception { .setOptions(GetPolicyOptions.newBuilder().build()) .build(); client.getIamPolicy(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } } @Test - void testIamPermissionsTest() throws Exception { + public void testIamPermissionsTest() throws Exception { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockIAMPolicy.addResponse(expectedResponse); @@ -669,22 +669,22 @@ void testIamPermissionsTest() throws Exception { .build(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); - Assertions.assertEquals(expectedResponse, actualResponse); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockIAMPolicy.getRequests(); - Assertions.assertEquals(1, actualRequests.size()); + Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assertions.assertEquals(request.getResource(), actualRequest.getResource()); - Assertions.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); - Assertions.assertTrue( + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); } @Test - void testIamPermissionsExceptionTest() throws Exception { + public void testIamPermissionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockIAMPolicy.addException(exception); @@ -695,7 +695,7 @@ void testIamPermissionsExceptionTest() throws Exception { .addAllPermissions(new ArrayList()) .build(); client.testIamPermissions(request); - Assertions.fail("No exception raised"); + Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception. } From 2cca11c3b7afc80d4a17dac5b077b4976a085148 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 10 May 2024 09:36:12 +0000 Subject: [PATCH 10/17] remove public modifiers. --- .../v1beta1/it/ITAutoPopulatedFields.java | 21 ++++++----- .../showcase/v1beta1/it/ITBidiStreaming.java | 6 ++-- .../showcase/v1beta1/it/ITClientShutdown.java | 14 ++++---- .../v1beta1/it/ITClientSideStreaming.java | 8 ++--- .../v1beta1/it/ITCommonServiceMixins.java | 12 +++---- .../google/showcase/v1beta1/it/ITCrud.java | 10 +++--- .../v1beta1/it/ITDynamicRoutingHeaders.java | 36 +++++++++---------- .../v1beta1/it/ITEndpointContext.java | 29 ++++++++------- .../google/showcase/v1beta1/it/ITGdch.java | 11 +++--- .../showcase/v1beta1/it/ITHttpAnnotation.java | 6 ++-- .../com/google/showcase/v1beta1/it/ITIam.java | 20 +++++------ .../v1beta1/it/ITLongRunningOperation.java | 11 +++--- .../showcase/v1beta1/it/ITNumericEnums.java | 6 ++-- .../showcase/v1beta1/it/ITOtelMetrics.java | 28 +++++++-------- .../showcase/v1beta1/it/ITPagination.java | 8 ++--- .../v1beta1/it/ITServerSideStreaming.java | 16 ++++----- .../showcase/v1beta1/it/ITUnaryCallable.java | 12 +++---- .../showcase/v1beta1/it/ITUnaryDeadline.java | 20 +++++------ 18 files changed, 133 insertions(+), 141 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java index f9595df978..3a2a68a1c0 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java @@ -121,7 +121,7 @@ public void sendMessage(ReqT message) { private EchoClient httpJsonClientWithRetries; @BeforeEach - public void createClients() throws Exception { + void createClients() throws Exception { RetrySettings defaultRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) @@ -157,14 +157,14 @@ public void createClients() throws Exception { } @AfterEach - public void destroyClient() { + void destroyClient() { grpcClientWithoutRetries.close(); grpcClientWithRetries.close(); httpJsonClient.close(); } @Test - public void testGrpc_autoPopulateRequestIdWhenAttemptedOnceSuccessfully() { + void testGrpc_autoPopulateRequestIdWhenAttemptedOnceSuccessfully() { List capturedRequestIds = new ArrayList<>(); grpcRequestInterceptor.setOnRequestIntercepted( request -> { @@ -181,7 +181,7 @@ public void testGrpc_autoPopulateRequestIdWhenAttemptedOnceSuccessfully() { } @Test - public void testGrpc_shouldNotAutoPopulateRequestIdIfSetInRequest() { + void testGrpc_shouldNotAutoPopulateRequestIdIfSetInRequest() { List capturedRequestIds = new ArrayList<>(); grpcRequestInterceptor.setOnRequestIntercepted( request -> { @@ -197,7 +197,7 @@ public void testGrpc_shouldNotAutoPopulateRequestIdIfSetInRequest() { } @Test - public void testHttpJson_autoPopulateRequestIdWhenAttemptedOnceSuccessfully() { + void testHttpJson_autoPopulateRequestIdWhenAttemptedOnceSuccessfully() { List capturedRequestIds = new ArrayList<>(); httpJsonInterceptor.setOnRequestIntercepted( request -> { @@ -214,7 +214,7 @@ public void testHttpJson_autoPopulateRequestIdWhenAttemptedOnceSuccessfully() { } @Test - public void testHttpJson_shouldNotAutoPopulateRequestIdIfSetInRequest() { + void testHttpJson_shouldNotAutoPopulateRequestIdIfSetInRequest() { String UUIDsent = UUID.randomUUID().toString(); List capturedRequestIds = new ArrayList<>(); httpJsonInterceptor.setOnRequestIntercepted( @@ -230,7 +230,7 @@ public void testHttpJson_shouldNotAutoPopulateRequestIdIfSetInRequest() { } @Test - public void testGRPC_setsSameRequestIdIfSetInRequestWhenRequestsAreRetried() throws Exception { + void testGRPC_setsSameRequestIdIfSetInRequestWhenRequestsAreRetried() throws Exception { List capturedRequestIds = new ArrayList<>(); grpcRequestInterceptor.setOnRequestIntercepted( request -> { @@ -264,7 +264,7 @@ public void testGRPC_setsSameRequestIdIfSetInRequestWhenRequestsAreRetried() thr } @Test - public void testGRPC_setsSameAutoPopulatedRequestIdWhenRequestsAreRetried() throws Exception { + void testGRPC_setsSameAutoPopulatedRequestIdWhenRequestsAreRetried() throws Exception { List capturedRequestIds = new ArrayList<>(); grpcRequestInterceptor.setOnRequestIntercepted( request -> { @@ -302,8 +302,7 @@ public void testGRPC_setsSameAutoPopulatedRequestIdWhenRequestsAreRetried() thro } @Test - public void testHttpJson_setsSameRequestIdIfSetInRequestWhenRequestsAreRetried() - throws Exception { + void testHttpJson_setsSameRequestIdIfSetInRequestWhenRequestsAreRetried() throws Exception { List capturedRequestIds = new ArrayList<>(); httpJsonInterceptor.setOnRequestIntercepted( request -> { @@ -336,7 +335,7 @@ public void testHttpJson_setsSameRequestIdIfSetInRequestWhenRequestsAreRetried() } @Test - public void testHttpJson_setsSameAutoPopulatedRequestIdWhenRequestsAreRetried() throws Exception { + void testHttpJson_setsSameAutoPopulatedRequestIdWhenRequestsAreRetried() throws Exception { List capturedRequestIds = new ArrayList<>(); httpJsonInterceptor.setOnRequestIntercepted( request -> { diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java index 0a47592e7b..72b8f1b0de 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITBidiStreaming.java @@ -39,13 +39,13 @@ class ITBidiStreaming { private static EchoClient grpcClient; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); } @AfterAll - public static void destroyClients() throws Exception { + static void destroyClients() throws Exception { grpcClient.close(); grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } @@ -57,7 +57,7 @@ public static void destroyClients() throws Exception { // three requests, respond twice for every request etc. If that happens, the response content may // not be exactly the same as request content. @Test - public void testGrpc_splitCall_shouldListensToResponse() throws Exception { + void testGrpc_splitCall_shouldListensToResponse() throws Exception { // given List expected = Arrays.asList("The rain in Spain stays mainly on the plain".split(" ")); TestResponseObserver responseObserver = new TestResponseObserver(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java index 2e384139a7..e55ee8d1ed 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientShutdown.java @@ -36,7 +36,7 @@ class ITClientShutdown { // Test to ensure the client can close + terminate properly @Test @Timeout(15) - public void testGrpc_closeClient() throws Exception { + void testGrpc_closeClient() throws Exception { EchoClient grpcClient = TestClientInitializer.createGrpcEchoClient(); assertClientTerminated(grpcClient); } @@ -44,7 +44,7 @@ public void testGrpc_closeClient() throws Exception { // Test to ensure the client can close + terminate properly @Test @Timeout(15) - public void testHttpJson_closeClient() throws Exception { + void testHttpJson_closeClient() throws Exception { EchoClient httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); assertClientTerminated(httpjsonClient); } @@ -52,7 +52,7 @@ public void testHttpJson_closeClient() throws Exception { // Test to ensure the client can close + terminate after a quick RPC invocation @Test @Timeout(15) - public void testGrpc_rpcInvoked_closeClient() throws Exception { + void testGrpc_rpcInvoked_closeClient() throws Exception { EchoClient grpcClient = TestClientInitializer.createGrpcEchoClient(); // Response is ignored for this test grpcClient.echo(EchoRequest.newBuilder().setContent("Test").build()); @@ -62,7 +62,7 @@ public void testGrpc_rpcInvoked_closeClient() throws Exception { // Test to ensure the client can close + terminate after a quick RPC invocation @Test @Timeout(15) - public void testHttpJson_rpcInvoked_closeClient() throws Exception { + void testHttpJson_rpcInvoked_closeClient() throws Exception { EchoClient httpjsonClient = TestClientInitializer.createHttpJsonEchoClient(); // Response is ignored for this test httpjsonClient.echo(EchoRequest.newBuilder().setContent("Test").build()); @@ -74,8 +74,7 @@ public void testHttpJson_rpcInvoked_closeClient() throws Exception { // the test does not continue on forever. @Test @Timeout(15) - public void testGrpc_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived() - throws Exception { + void testGrpc_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived() throws Exception { // Set the maxAttempts to 1 to ensure there are no retries scheduled. The single RPC // invocation should time out in 15s, but the client will receive a response in 2s. // Any outstanding tasks (timeout tasks) should be cancelled once a response has been @@ -108,8 +107,7 @@ public void testGrpc_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived( // the test does not continue on forever. @Test @Timeout(15) - public void testHttpJson_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived() - throws Exception { + void testHttpJson_rpcInvokedWithLargeTimeout_closeClientOnceResponseReceived() throws Exception { // Set the maxAttempts to 1 to ensure there are no retries scheduled. The single RPC // invocation should time out in 15s, but the client will receive a response in 2s. // Any outstanding tasks (timeout tasks) should be cancelled once a response has been diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java index aab041982a..61b507f49a 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITClientSideStreaming.java @@ -41,19 +41,19 @@ class ITClientSideStreaming { private static EchoClient grpcClient; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { grpcClient.close(); grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } @Test - public void testGrpc_sendStreamedContent_receiveConcatenatedResponse() + void testGrpc_sendStreamedContent_receiveConcatenatedResponse() throws ExecutionException, InterruptedException { CollectStreamObserver responseObserver = new CollectStreamObserver<>(); ApiStreamObserver requestObserver = @@ -71,7 +71,7 @@ public void testGrpc_sendStreamedContent_receiveConcatenatedResponse() } @Test - public void testGrpc_sendStreamedContent_handleServerError() { + void testGrpc_sendStreamedContent_handleServerError() { CollectStreamObserver responseObserver = new CollectStreamObserver<>(); ApiStreamObserver requestObserver = grpcClient.collectCallable().clientStreamingCall(responseObserver); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java index 12bb2db890..a64f95a258 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCommonServiceMixins.java @@ -57,7 +57,7 @@ class ITCommonServiceMixins { private static EchoClient httpjsonClient; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); @@ -66,7 +66,7 @@ public static void createClients() throws Exception { } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); @@ -76,7 +76,7 @@ public static void destroyClients() throws InterruptedException { } @Test - public void testGrpc_getLocation() { + void testGrpc_getLocation() { GetLocationRequest request = GetLocationRequest.newBuilder().setName("projects/showcase/location/us-central1").build(); Location location = grpcClient.getLocation(request); @@ -89,7 +89,7 @@ public void testGrpc_getLocation() { } @Test - public void testGrpc_listLocations() { + void testGrpc_listLocations() { ListLocationsRequest request = ListLocationsRequest.newBuilder().setName("projects/showcase").build(); EchoClient.ListLocationsPagedResponse locationsPagedResponse = @@ -104,7 +104,7 @@ public void testGrpc_listLocations() { } @Test - public void testHttpJson_getLocation() { + void testHttpJson_getLocation() { GetLocationRequest request = GetLocationRequest.newBuilder().setName("projects/showcase/locations/us-central1").build(); Location location = httpjsonClient.getLocation(request); @@ -117,7 +117,7 @@ public void testHttpJson_getLocation() { } @Test - public void testHttpJson_listLocations() { + void testHttpJson_listLocations() { ListLocationsRequest request = ListLocationsRequest.newBuilder().setName("projects/showcase").build(); EchoClient.ListLocationsPagedResponse locationsPagedResponse = diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java index de44cc4889..2bd0f770ed 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITCrud.java @@ -68,7 +68,7 @@ public static void destroyClients() throws InterruptedException { } @BeforeEach - public void cleanupData() { + void cleanupData() { IdentityClient.ListUsersPagedResponse pagedResponse = grpcClient.listUsers(ListUsersRequest.newBuilder().setPageSize(5).build()); for (IdentityClient.ListUsersPage listUsersPage : pagedResponse.iteratePages()) { @@ -81,7 +81,7 @@ public void cleanupData() { } @Test - public void testHttpJson_Create() { + void testHttpJson_Create() { User userResponse = createDefaultUser(); // These properties should be the same @@ -99,7 +99,7 @@ public void testHttpJson_Create() { } @Test - public void testHttpJson_Read() { + void testHttpJson_Read() { List expectedUsersList = ImmutableList.of( createDefaultUser(), @@ -126,7 +126,7 @@ public void testHttpJson_Read() { } @Test - public void testHttpJson_Update() { + void testHttpJson_Update() { User userResponse = createDefaultUser(); // Update multiple fields in the User. Age + Nickname are not included in the FieldMask // userResponse's enableNotifications field is populated from the server @@ -161,7 +161,7 @@ public void testHttpJson_Update() { } @Test - public void testHttpJson_Delete() { + void testHttpJson_Delete() { User userResponse = createDefaultUser(); httpjsonClient.deleteUser( diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java index bfa8f5ea1c..a1f34f5591 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java @@ -128,7 +128,7 @@ public void onClose(int statusCode, HttpJsonMetadata trailers) { private ComplianceClient httpJsonComplianceClient; @BeforeEach - public void createClients() throws Exception { + void createClients() throws Exception { // Create gRPC Interceptor and Client grpcInterceptor = new GrpcCapturingClientInterceptor(); grpcClient = TestClientInitializer.createGrpcEchoClient(ImmutableList.of(grpcInterceptor)); @@ -154,7 +154,7 @@ public void createClients() throws Exception { } @AfterEach - public void destroyClient() throws InterruptedException { + void destroyClient() throws InterruptedException { grpcClient.close(); grpcComplianceClient.close(); @@ -172,35 +172,35 @@ public void destroyClient() throws InterruptedException { } @Test - public void testGrpc_noRoutingHeaderUsed() { + void testGrpc_noRoutingHeaderUsed() { grpcClient.echo(EchoRequest.newBuilder().build()); String headerValue = grpcInterceptor.metadata.get(REQUEST_PARAMS_HEADER_KEY); assertThat(headerValue).isNull(); } @Test - public void testHttpJson_noRoutingHeaderUsed() { + void testHttpJson_noRoutingHeaderUsed() { httpJsonClient.echo(EchoRequest.newBuilder().build()); String headerValue = httpJsonInterceptor.requestParam; assertThat(headerValue).isNull(); } @Test - public void testGrpc_emptyHeader() { + void testGrpc_emptyHeader() { grpcClient.echo(EchoRequest.newBuilder().setHeader("").build()); String headerValue = grpcInterceptor.metadata.get(REQUEST_PARAMS_HEADER_KEY); assertThat(headerValue).isNull(); } @Test - public void testHttpJson_emptyHeader() { + void testHttpJson_emptyHeader() { httpJsonClient.echo(EchoRequest.newBuilder().setHeader("").build()); String headerValue = httpJsonInterceptor.requestParam; assertThat(headerValue).isNull(); } @Test - public void testGrpc_matchesHeaderName() { + void testGrpc_matchesHeaderName() { grpcClient.echo(EchoRequest.newBuilder().setHeader("potato").build()); String headerValue = grpcInterceptor.metadata.get(REQUEST_PARAMS_HEADER_KEY); assertThat(headerValue).isNotNull(); @@ -211,7 +211,7 @@ public void testGrpc_matchesHeaderName() { } @Test - public void testGrpc_implicitHeaders_enumsEncodedasInt() { + void testGrpc_implicitHeaders_enumsEncodedasInt() { RepeatRequest request = RepeatRequest.newBuilder().setInfo(ComplianceData.newBuilder().setFKingdomValue(5)).build(); RepeatResponse actualResponse = grpcComplianceClient.repeatDataSimplePath(request); @@ -228,7 +228,7 @@ public void testGrpc_implicitHeaders_enumsEncodedasInt() { } @Test - public void testHttpJson_implicitHeaders_enumsEncodedasInt() { + void testHttpJson_implicitHeaders_enumsEncodedasInt() { RepeatRequest request = RepeatRequest.newBuilder() .setInfo( @@ -256,7 +256,7 @@ public void testHttpJson_implicitHeaders_enumsEncodedasInt() { } @Test - public void testHttpJson_matchesHeaderName() { + void testHttpJson_matchesHeaderName() { httpJsonClient.echo(EchoRequest.newBuilder().setHeader("potato").build()); String headerValue = httpJsonInterceptor.requestParam; assertThat(headerValue).isNotNull(); @@ -267,7 +267,7 @@ public void testHttpJson_matchesHeaderName() { } @Test - public void testGrpc_matchesOtherHeaderName() { + void testGrpc_matchesOtherHeaderName() { grpcClient.echo(EchoRequest.newBuilder().setOtherHeader("instances/456").build()); String headerValue = grpcInterceptor.metadata.get(REQUEST_PARAMS_HEADER_KEY); assertThat(headerValue).isNotNull(); @@ -278,7 +278,7 @@ public void testGrpc_matchesOtherHeaderName() { } @Test - public void testHttpJson_matchesOtherHeaderName() { + void testHttpJson_matchesOtherHeaderName() { httpJsonClient.echo(EchoRequest.newBuilder().setOtherHeader("instances/456").build()); String headerValue = httpJsonInterceptor.requestParam; assertThat(headerValue).isNotNull(); @@ -289,7 +289,7 @@ public void testHttpJson_matchesOtherHeaderName() { } @Test - public void testGrpc_matchesMultipleOfSameRoutingHeader_usesHeader() { + void testGrpc_matchesMultipleOfSameRoutingHeader_usesHeader() { grpcClient.echo(EchoRequest.newBuilder().setHeader("projects/123/instances/456").build()); String headerValue = grpcInterceptor.metadata.get(REQUEST_PARAMS_HEADER_KEY); assertThat(headerValue).isNotNull(); @@ -306,7 +306,7 @@ public void testGrpc_matchesMultipleOfSameRoutingHeader_usesHeader() { } @Test - public void testHttpJson_matchesMultipleOfSameRoutingHeader_usesHeader() { + void testHttpJson_matchesMultipleOfSameRoutingHeader_usesHeader() { httpJsonClient.echo(EchoRequest.newBuilder().setHeader("projects/123/instances/456").build()); String headerValue = httpJsonInterceptor.requestParam; assertThat(headerValue).isNotNull(); @@ -323,7 +323,7 @@ public void testHttpJson_matchesMultipleOfSameRoutingHeader_usesHeader() { } @Test - public void testGrpc_matchesMultipleOfSameRoutingHeader_usesOtherHeader() { + void testGrpc_matchesMultipleOfSameRoutingHeader_usesOtherHeader() { grpcClient.echo(EchoRequest.newBuilder().setOtherHeader("projects/123/instances/456").build()); String headerValue = grpcInterceptor.metadata.get(REQUEST_PARAMS_HEADER_KEY); assertThat(headerValue).isNotNull(); @@ -335,7 +335,7 @@ public void testGrpc_matchesMultipleOfSameRoutingHeader_usesOtherHeader() { } @Test - public void testHttpJson_matchesMultipleOfSameRoutingHeader_usesOtherHeader() { + void testHttpJson_matchesMultipleOfSameRoutingHeader_usesOtherHeader() { httpJsonClient.echo( EchoRequest.newBuilder().setOtherHeader("projects/123/instances/456").build()); String headerValue = httpJsonInterceptor.requestParam; @@ -348,7 +348,7 @@ public void testHttpJson_matchesMultipleOfSameRoutingHeader_usesOtherHeader() { } @Test - public void testGrpc_matchesMultipleRoutingHeaders() { + void testGrpc_matchesMultipleRoutingHeaders() { grpcClient.echo( EchoRequest.newBuilder() .setHeader("regions/123/zones/456") @@ -369,7 +369,7 @@ public void testGrpc_matchesMultipleRoutingHeaders() { } @Test - public void testHttpJson_matchesMultipleRoutingHeaders() { + void testHttpJson_matchesMultipleRoutingHeaders() { httpJsonClient.echo( EchoRequest.newBuilder() .setHeader("regions/123/zones/456") diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java index 8e5a492221..abf3844a6f 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITEndpointContext.java @@ -222,7 +222,7 @@ public Credentials getCredentials() { private EchoClient echoClient; @AfterEach - public void cleanup() throws InterruptedException { + void cleanup() throws InterruptedException { if (echoClient != null) { echoClient.close(); echoClient.awaitTermination( @@ -232,7 +232,7 @@ public void cleanup() throws InterruptedException { // Default (no configuration) @Test - public void endpointResolution_default() throws IOException { + void endpointResolution_default() throws IOException { EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() .setCredentialsProvider(UniverseDomainCredentialsProvider.create()) @@ -245,7 +245,7 @@ public void endpointResolution_default() throws IOException { // User configuration @Test - public void endpointResolution_userSetEndpoint() throws IOException { + void endpointResolution_userSetEndpoint() throws IOException { String customEndpoint = "test.com:123"; EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() @@ -259,7 +259,7 @@ public void endpointResolution_userSetEndpoint() throws IOException { } @Test - public void endpointResolution_userSetUniverseDomainAndNoUserSetEndpoint() throws IOException { + void endpointResolution_userSetUniverseDomainAndNoUserSetEndpoint() throws IOException { String customUniverseDomain = "random.com"; EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() @@ -273,7 +273,7 @@ public void endpointResolution_userSetUniverseDomainAndNoUserSetEndpoint() throw } @Test - public void endpointResolution_userSetEndpointAndUniverseDomain() throws IOException { + void endpointResolution_userSetEndpointAndUniverseDomain() throws IOException { String customEndpoint = "custom.endpoint.com:443"; String customUniverseDomain = "random.com"; EchoSettings echoSettings = @@ -291,7 +291,7 @@ public void endpointResolution_userSetEndpointAndUniverseDomain() throws IOExcep } @Test - public void universeDomainValidation_credentialsGDU_noUserConfiguration() throws IOException { + void universeDomainValidation_credentialsGDU_noUserConfiguration() throws IOException { EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() .setCredentialsProvider(UniverseDomainCredentialsProvider.create()) @@ -308,7 +308,7 @@ public void universeDomainValidation_credentialsGDU_noUserConfiguration() throws } @Test - public void universeDomainValidation_credentialsNonGDU_noUserConfiguration() throws IOException { + void universeDomainValidation_credentialsNonGDU_noUserConfiguration() throws IOException { EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() .setCredentialsProvider(UniverseDomainCredentialsProvider.create("random.com")) @@ -328,8 +328,7 @@ public void universeDomainValidation_credentialsNonGDU_noUserConfiguration() thr } @Test - public void universeDomainValidation_credentialsNonGDUMatchesUserConfiguration() - throws IOException { + void universeDomainValidation_credentialsNonGDUMatchesUserConfiguration() throws IOException { String universeDomain = "random.com"; EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() @@ -348,7 +347,7 @@ public void universeDomainValidation_credentialsNonGDUMatchesUserConfiguration() } @Test - public void universeDomainValidation_credentialsNonGDUDoesNotMatchUserConfiguration() + void universeDomainValidation_credentialsNonGDUDoesNotMatchUserConfiguration() throws IOException { String universeDomain = "random.com"; String userConfigurationUniverseDomain = "test.com"; @@ -373,7 +372,7 @@ public void universeDomainValidation_credentialsNonGDUDoesNotMatchUserConfigurat // This test uses NoCredentialsProvider (will default to GDU) @Test - public void universeDomainValidation_noCredentials_noUserSetUniverseDomain() throws IOException { + void universeDomainValidation_noCredentials_noUserSetUniverseDomain() throws IOException { EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() .setCredentialsProvider(NoCredentialsProvider.create()) @@ -391,7 +390,7 @@ public void universeDomainValidation_noCredentials_noUserSetUniverseDomain() thr // This test uses NoCredentialsProvider (will default to GDU) @Test - public void universeDomainValidation_noCredentials_userSetUniverseDomain() throws IOException { + void universeDomainValidation_noCredentials_userSetUniverseDomain() throws IOException { String universeDomain = "random.com"; EchoSettings echoSettings = ExtendedEchoSettings.newBuilder() @@ -414,7 +413,7 @@ public void universeDomainValidation_noCredentials_userSetUniverseDomain() throw // Default in Builder (no configuration) @Test - public void endpointResolution_defaultViaBuilder() { + void endpointResolution_defaultViaBuilder() { EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder(); // `StubSettings.newBuilder()` will return the clientSettingsEndpoint Truth.assertThat(echoSettingsBuilder.getEndpoint()).isEqualTo(null); @@ -422,7 +421,7 @@ public void endpointResolution_defaultViaBuilder() { // User configuration in Builder @Test - public void endpointResolution_userConfigurationViaBuilder() { + void endpointResolution_userConfigurationViaBuilder() { EchoSettings.Builder echoSettingsBuilder = EchoSettings.newBuilder().setEndpoint("test.com:123"); // `StubSettings.newBuilder()` will return the clientSettingsEndpoint @@ -430,7 +429,7 @@ public void endpointResolution_userConfigurationViaBuilder() { } @Test - public void endpointResolution_builderBuilderBackToBuilder() throws IOException { + void endpointResolution_builderBuilderBackToBuilder() throws IOException { String customEndpoint = "test.com:123"; EchoStubSettings.Builder echoStubSettingsBuilder = EchoStubSettings.newBuilder().setEndpoint(customEndpoint); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java index c4eb8d1997..fbc3fd8083 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java @@ -75,7 +75,7 @@ class ITGdch { private URI tokenUri; @BeforeEach - public void setup(@TempDir Path tempDir) throws IOException, URISyntaxException { + void setup(@TempDir Path tempDir) throws IOException, URISyntaxException { transportFactory = new InterceptingMockTokenServerTransportFactory(); prepareCredentials(tempDir); settings = @@ -85,7 +85,7 @@ public void setup(@TempDir Path tempDir) throws IOException, URISyntaxException } @AfterEach - public void tearDown() throws InterruptedException { + void tearDown() throws InterruptedException { if (client != null) { client.close(); client.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); @@ -131,7 +131,7 @@ private void prepareCredentials(Path tempDir) throws IOException { * @throws IOException */ @Test - public void testCreateClient_withGdchCredentialAndNoAudience_defaultsToEndpointBasedAudience() + void testCreateClient_withGdchCredentialAndNoAudience_defaultsToEndpointBasedAudience() throws IOException { // we create the client as usual - no audience passed @@ -176,9 +176,8 @@ public void testCreateClient_withGdchCredentialAndNoAudience_defaultsToEndpointB * @throws IOException */ @Test - public void - testCreateClient_withGdchCredentialWithValidAudience_usesCredentialWithPassedAudience() - throws IOException { + void testCreateClient_withGdchCredentialWithValidAudience_usesCredentialWithPassedAudience() + throws IOException { // Similar to the previous test, create a client as usual but this time we pass a explicit // audience. It should diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java index a16af1cba5..a8197396f4 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java @@ -65,7 +65,7 @@ public static Stream data() { private static Map> validComplianceRpcMap; @BeforeAll - public static void createClients() throws IOException, GeneralSecurityException { + static void createClients() throws IOException, GeneralSecurityException { ComplianceSuite.Builder builder = ComplianceSuite.newBuilder(); JsonFormat.parser() .merge( @@ -109,7 +109,7 @@ public static void createClients() throws IOException, GeneralSecurityException } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { httpjsonClient.close(); httpjsonClient.awaitTermination( TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); @@ -120,7 +120,7 @@ public static void destroyClients() throws InterruptedException { // works as intended @ParameterizedTest @MethodSource("data") - public void testComplianceGroup(String groupName) { + void testComplianceGroup(String groupName) { Optional complianceGroupOptional = complianceSuite.getGroupList().stream() .filter(x -> x.getName().equals(groupName)) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java index 9041ff0219..893eeb2679 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITIam.java @@ -46,13 +46,13 @@ class ITIam { private String resourceName; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { grpcClient = TestClientInitializer.createGrpcIdentityClient(); httpjsonClient = TestClientInitializer.createHttpJsonIdentityClient(); } @BeforeEach - public void setupTests() { + void setupTests() { resourceName = "users/" + UUID.randomUUID().toString().substring(0, 8); } @@ -67,7 +67,7 @@ public static void destroyClients() throws InterruptedException { } @Test - public void testGrpc_setIamPolicy() { + void testGrpc_setIamPolicy() { SetIamPolicyRequest policyRequest = SetIamPolicyRequest.newBuilder() .setPolicy(DEFAULT_POLICY) @@ -78,7 +78,7 @@ public void testGrpc_setIamPolicy() { } @Test - public void testHttpJson_setIamPolicy() { + void testHttpJson_setIamPolicy() { SetIamPolicyRequest policyRequest = SetIamPolicyRequest.newBuilder() .setPolicy(DEFAULT_POLICY) @@ -89,7 +89,7 @@ public void testHttpJson_setIamPolicy() { } @Test - public void testGrpc_getIamPolicy() { + void testGrpc_getIamPolicy() { SetIamPolicyRequest policyRequest = SetIamPolicyRequest.newBuilder() .setPolicy(DEFAULT_POLICY) @@ -104,7 +104,7 @@ public void testGrpc_getIamPolicy() { } @Test - public void testHttpJson_getIamPolicy() { + void testHttpJson_getIamPolicy() { SetIamPolicyRequest policyRequest = SetIamPolicyRequest.newBuilder() .setPolicy(DEFAULT_POLICY) @@ -119,7 +119,7 @@ public void testHttpJson_getIamPolicy() { } @Test - public void testGrpc_testIamPermissions() { + void testGrpc_testIamPermissions() { SetIamPolicyRequest policyRequest = SetIamPolicyRequest.newBuilder() .setPolicy(DEFAULT_POLICY) @@ -140,7 +140,7 @@ public void testGrpc_testIamPermissions() { } @Test - public void testHttpJson_testIamPermissions() { + void testHttpJson_testIamPermissions() { SetIamPolicyRequest policyRequest = SetIamPolicyRequest.newBuilder() .setPolicy(DEFAULT_POLICY) @@ -165,14 +165,14 @@ public void testHttpJson_testIamPermissions() { // cases, and we simply assert that an exception has been thrown for a single case with a single // RPC (No resource in the request for SetIamPolicy's RPC). @Test - public void testGrpc_iamThrowsException() { + void testGrpc_iamThrowsException() { SetIamPolicyRequest setIamPolicyRequest = SetIamPolicyRequest.newBuilder().build(); assertThrows( InvalidArgumentException.class, () -> grpcClient.setIamPolicy(setIamPolicyRequest)); } @Test - public void testHttpJson_iamThrowsException() { + void testHttpJson_iamThrowsException() { SetIamPolicyRequest setIamPolicyRequest = SetIamPolicyRequest.newBuilder().build(); assertThrows( InvalidArgumentException.class, () -> httpjsonClient.setIamPolicy(setIamPolicyRequest)); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java index a62ea11909..bab3d04cd5 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITLongRunningOperation.java @@ -40,7 +40,7 @@ class ITLongRunningOperation { @Test - public void testGRPC_LROSuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { + void testGRPC_LROSuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { RetrySettings initialUnaryRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(3000L)) @@ -79,7 +79,7 @@ public void testGRPC_LROSuccessfulResponse_doesNotExceedTotalTimeout() throws Ex } @Test - public void testHttpJson_LROSuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { + void testHttpJson_LROSuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { RetrySettings initialUnaryRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(3000L)) @@ -119,7 +119,7 @@ public void testHttpJson_LROSuccessfulResponse_doesNotExceedTotalTimeout() throw } @Test - public void testGRPC_LROUnsuccessfulResponse_exceedsTotalTimeout_throwsDeadlineExceededException() + void testGRPC_LROUnsuccessfulResponse_exceedsTotalTimeout_throwsDeadlineExceededException() throws Exception { RetrySettings initialUnaryRetrySettings = RetrySettings.newBuilder() @@ -157,9 +157,8 @@ public void testGRPC_LROUnsuccessfulResponse_exceedsTotalTimeout_throwsDeadlineE } @Test - public void - testHttpJson_LROUnsuccessfulResponse_exceedsTotalTimeout_throwsDeadlineExceededException() - throws Exception { + void testHttpJson_LROUnsuccessfulResponse_exceedsTotalTimeout_throwsDeadlineExceededException() + throws Exception { RetrySettings initialUnaryRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java index 187a560cd0..76c54a803c 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITNumericEnums.java @@ -37,7 +37,7 @@ class ITNumericEnums { private static ComplianceClient httpjsonClient; @BeforeAll - public static void createClients() throws GeneralSecurityException, IOException { + static void createClients() throws GeneralSecurityException, IOException { ComplianceSettings complianceSettings = ComplianceSettings.newHttpJsonBuilder() .setCredentialsProvider(NoCredentialsProvider.create()) @@ -52,14 +52,14 @@ public static void createClients() throws GeneralSecurityException, IOException } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { httpjsonClient.close(); httpjsonClient.awaitTermination( TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } @Test - public void verifyEnums() { + void verifyEnums() { EnumRequest request = EnumRequest.newBuilder().setUnknownEnum(true).build(); EnumResponse initialResponse = httpjsonClient.getEnum(request); assertEquals(initialResponse, httpjsonClient.verifyEnum(initialResponse)); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java index 851ac1fbcd..c2ecff034d 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelMetrics.java @@ -142,7 +142,7 @@ private OpenTelemetryMetricsRecorder createOtelMetricsRecorder( } @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { inMemoryMetricReader = InMemoryMetricReader.create(); OpenTelemetryMetricsRecorder otelMetricsRecorder = createOtelMetricsRecorder(inMemoryMetricReader); @@ -155,7 +155,7 @@ public void setup() throws Exception { } @AfterEach - public void cleanup() throws InterruptedException { + void cleanup() throws InterruptedException { inMemoryMetricReader.shutdown(); grpcClient.close(); @@ -290,7 +290,7 @@ private List getMetricDataList() throws InterruptedException { } @Test - public void testGrpc_operationSucceeded_recordsMetrics() throws InterruptedException { + void testGrpc_operationSucceeded_recordsMetrics() throws InterruptedException { int attemptCount = 1; EchoRequest echoRequest = EchoRequest.newBuilder().setContent("test_grpc_operation_succeeded").build(); @@ -313,7 +313,7 @@ public void testGrpc_operationSucceeded_recordsMetrics() throws InterruptedExcep @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test - public void testHttpJson_operationSucceeded_recordsMetrics() throws InterruptedException { + void testHttpJson_operationSucceeded_recordsMetrics() throws InterruptedException { int attemptCount = 1; EchoRequest echoRequest = EchoRequest.newBuilder().setContent("test_http_operation_succeeded").build(); @@ -335,7 +335,7 @@ public void testHttpJson_operationSucceeded_recordsMetrics() throws InterruptedE } @Test - public void testGrpc_operationCancelled_recordsMetrics() throws Exception { + void testGrpc_operationCancelled_recordsMetrics() throws Exception { int attemptCount = 1; BlockRequest blockRequest = BlockRequest.newBuilder() @@ -366,7 +366,7 @@ public void testGrpc_operationCancelled_recordsMetrics() throws Exception { @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test - public void testHttpJson_operationCancelled_recordsMetrics() throws Exception { + void testHttpJson_operationCancelled_recordsMetrics() throws Exception { int attemptCount = 1; BlockRequest blockRequest = BlockRequest.newBuilder().setResponseDelay(Duration.newBuilder().setSeconds(5)).build(); @@ -393,7 +393,7 @@ public void testHttpJson_operationCancelled_recordsMetrics() throws Exception { } @Test - public void testGrpc_operationFailed_recordsMetrics() throws InterruptedException { + void testGrpc_operationFailed_recordsMetrics() throws InterruptedException { int attemptCount = 1; Code statusCode = Code.INVALID_ARGUMENT; BlockRequest blockRequest = @@ -423,7 +423,7 @@ public void testGrpc_operationFailed_recordsMetrics() throws InterruptedExceptio @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test - public void testHttpJson_operationFailed_recordsMetrics() throws InterruptedException { + void testHttpJson_operationFailed_recordsMetrics() throws InterruptedException { int attemptCount = 1; Code statusCode = Code.INVALID_ARGUMENT; BlockRequest blockRequest = @@ -452,7 +452,7 @@ public void testHttpJson_operationFailed_recordsMetrics() throws InterruptedExce } @Test - public void testGrpc_attemptFailedRetriesExhausted_recordsMetrics() throws Exception { + void testGrpc_attemptFailedRetriesExhausted_recordsMetrics() throws Exception { int attemptCount = 3; Code statusCode = Code.UNAVAILABLE; // A custom EchoClient is used in this test because retries have jitter, and we cannot @@ -519,7 +519,7 @@ public void testGrpc_attemptFailedRetriesExhausted_recordsMetrics() throws Excep @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test - public void testHttpJson_attemptFailedRetriesExhausted_recordsMetrics() throws Exception { + void testHttpJson_attemptFailedRetriesExhausted_recordsMetrics() throws Exception { int attemptCount = 3; Code statusCode = Code.UNAVAILABLE; // A custom EchoClient is used in this test because retries have jitter, and we cannot @@ -586,7 +586,7 @@ public void testHttpJson_attemptFailedRetriesExhausted_recordsMetrics() throws E } @Test - public void testGrpc_attemptPermanentFailure_recordsMetrics() throws InterruptedException { + void testGrpc_attemptPermanentFailure_recordsMetrics() throws InterruptedException { int attemptCount = 1; Code statusCode = Code.INVALID_ARGUMENT; BlockRequest blockRequest = @@ -614,7 +614,7 @@ public void testGrpc_attemptPermanentFailure_recordsMetrics() throws Interrupted @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test - public void testHttpJson_attemptPermanentFailure_recordsMetrics() throws InterruptedException { + void testHttpJson_attemptPermanentFailure_recordsMetrics() throws InterruptedException { int attemptCount = 1; Code statusCode = Code.INVALID_ARGUMENT; BlockRequest blockRequest = @@ -641,7 +641,7 @@ public void testHttpJson_attemptPermanentFailure_recordsMetrics() throws Interru } @Test - public void testGrpc_multipleFailedAttempts_successfulOperation() throws Exception { + void testGrpc_multipleFailedAttempts_successfulOperation() throws Exception { int attemptCount = 3; // Disable Jitter on this test to try and ensure that the there are 3 attempts made // for test. The first two calls should result in a DEADLINE_EXCEEDED exception as @@ -715,7 +715,7 @@ public void testGrpc_multipleFailedAttempts_successfulOperation() throws Excepti @Disabled("https://github.com/googleapis/sdk-platform-java/issues/2503") @Test - public void testHttpJson_multipleFailedAttempts_successfulOperation() throws Exception { + void testHttpJson_multipleFailedAttempts_successfulOperation() throws Exception { int attemptCount = 3; RetrySettings retrySettings = RetrySettings.newBuilder() diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java index 73dc14fbfc..ebcabeab9e 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITPagination.java @@ -33,7 +33,7 @@ class ITPagination { private static EchoClient httpjsonClient; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); // Create Http JSON Echo Client @@ -41,7 +41,7 @@ public static void createClients() throws Exception { } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); @@ -60,7 +60,7 @@ public static void destroyClients() throws InterruptedException { // Page # | - | - | - | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 // Token # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 @Test - public void testPagedExpandWithTokenGrpc() { + void testPagedExpandWithTokenGrpc() { int pageSize = 2; int pageToken = 3; String content = "A series of words that will be sent back one by one"; @@ -97,7 +97,7 @@ public void testPagedExpandWithTokenGrpc() { // Page # | - | - | - | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 // Token # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 @Test - public void testPagedExpandWithTokenHttpJson() { + void testPagedExpandWithTokenHttpJson() { int pageSize = 2; int pageToken = 3; String content = "A series of words that will be sent back one by one"; diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java index bf01099b09..8439e19411 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java @@ -49,7 +49,7 @@ class ITServerSideStreaming { private static EchoClient httpjsonClient; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); // Create Http JSON Echo Client @@ -57,7 +57,7 @@ public static void createClients() throws Exception { } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); @@ -67,7 +67,7 @@ public static void destroyClients() throws InterruptedException { } @Test - public void testGrpc_receiveStreamedContent() { + void testGrpc_receiveStreamedContent() { String content = "The rain in Spain stays mainly on the plain!"; ServerStream responseStream = grpcClient.expandCallable().call(ExpandRequest.newBuilder().setContent(content).build()); @@ -84,7 +84,7 @@ public void testGrpc_receiveStreamedContent() { } @Test - public void testGrpc_receiveStreamedContentStreamAPI() { + void testGrpc_receiveStreamedContentStreamAPI() { String content = "The rain in Spain stays mainly on the plain!"; ServerStream responseStream = grpcClient.expandCallable().call(ExpandRequest.newBuilder().setContent(content).build()); @@ -96,7 +96,7 @@ public void testGrpc_receiveStreamedContentStreamAPI() { } @Test - public void testGrpc_serverError_receiveErrorAfterLastWordInStream() { + void testGrpc_serverError_receiveErrorAfterLastWordInStream() { String content = "The rain in Spain"; Status cancelledStatus = Status.newBuilder().setCode(StatusCode.Code.CANCELLED.ordinal()).build(); @@ -116,7 +116,7 @@ public void testGrpc_serverError_receiveErrorAfterLastWordInStream() { } @Test - public void testGrpc_serverWaitTimeout_watchdogCancelsStream() throws Exception { + void testGrpc_serverWaitTimeout_watchdogCancelsStream() throws Exception { EchoSettings.Builder settings = EchoSettings.newBuilder() .setCredentialsProvider(NoCredentialsProvider.create()) @@ -160,7 +160,7 @@ public void testGrpc_serverWaitTimeout_watchdogCancelsStream() throws Exception } @Test - public void testHttpJson_receiveStreamedContent() { + void testHttpJson_receiveStreamedContent() { String content = "The rain in Spain stays mainly on the plain!"; ServerStream responseStream = httpjsonClient @@ -181,7 +181,7 @@ public void testHttpJson_receiveStreamedContent() { @Disabled( value = "Ignore until https://github.com/googleapis/gapic-showcase/issues/1286 is resolved") @Test - public void testHttpJson_serverError_receiveErrorAfterLastWordInStream() { + void testHttpJson_serverError_receiveErrorAfterLastWordInStream() { String content = "The rain in Spain"; Status cancelledStatus = Status.newBuilder().setCode(StatusCode.Code.CANCELLED.ordinal()).build(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java index 6c3f4bf030..4d6018f6fc 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryCallable.java @@ -39,7 +39,7 @@ class ITUnaryCallable { private static EchoClient httpjsonClient; @BeforeAll - public static void createClients() throws Exception { + static void createClients() throws Exception { // Create gRPC Echo Client grpcClient = TestClientInitializer.createGrpcEchoClient(); // Create Http JSON Echo Client @@ -47,7 +47,7 @@ public static void createClients() throws Exception { } @AfterAll - public static void destroyClients() throws InterruptedException { + static void destroyClients() throws InterruptedException { grpcClient.close(); httpjsonClient.close(); @@ -57,13 +57,13 @@ public static void destroyClients() throws InterruptedException { } @Test - public void testGrpc_receiveContent() { + void testGrpc_receiveContent() { assertThat(echoGrpc("grpc-echo?")).isEqualTo("grpc-echo?"); assertThat(echoGrpc("grpc-echo!")).isEqualTo("grpc-echo!"); } @Test - public void testGrpc_serverResponseError_throwsException() { + void testGrpc_serverResponseError_throwsException() { Status cancelledStatus = Status.newBuilder().setCode(StatusCode.Code.CANCELLED.ordinal()).build(); EchoRequest requestWithServerError = EchoRequest.newBuilder().setError(cancelledStatus).build(); @@ -73,13 +73,13 @@ public void testGrpc_serverResponseError_throwsException() { } @Test - public void testHttpJson_receiveContent() { + void testHttpJson_receiveContent() { assertThat(echoHttpJson("http-echo?")).isEqualTo("http-echo?"); assertThat(echoHttpJson("http-echo!")).isEqualTo("http-echo!"); } @Test - public void testHttpJson_serverResponseError_throwsException() { + void testHttpJson_serverResponseError_throwsException() { EchoRequest requestWithServerError = EchoRequest.newBuilder() .setError(Status.newBuilder().setCode(StatusCode.Code.CANCELLED.ordinal()).build()) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java index 98a507e5fe..984598bc9e 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITUnaryDeadline.java @@ -42,7 +42,7 @@ class ITUnaryDeadline { @Test - public void testGRPC_unarySuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { + void testGRPC_unarySuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { RetrySettings defaultNoRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) @@ -76,7 +76,7 @@ public void testGRPC_unarySuccessfulResponse_doesNotExceedTotalTimeout() throws } @Test - public void testHttpJson_unarySuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { + void testHttpJson_unarySuccessfulResponse_doesNotExceedTotalTimeout() throws Exception { RetrySettings defaultNoRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) @@ -113,8 +113,7 @@ public void testHttpJson_unarySuccessfulResponse_doesNotExceedTotalTimeout() thr // Retry is configured by setting the initial RPC timeout (1.5s) to be less than // the RPC delay (2s). The next RPC timeout (3s) will wait long enough for the delay. @Test - public void testGRPC_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTotalTimeout() - throws Exception { + void testGRPC_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTotalTimeout() throws Exception { RetrySettings defaultRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(1500L)) @@ -148,7 +147,7 @@ public void testGRPC_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTotalTim // Retry is configured by setting the initial RPC timeout (1.5s) to be less than // the RPC delay (2s). The next RPC timeout (3s) will wait long enough for the delay. @Test - public void testHttpJson_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTotalTimeout() + void testHttpJson_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTotalTimeout() throws Exception { RetrySettings defaultRetrySettings = RetrySettings.newBuilder() @@ -184,7 +183,7 @@ public void testHttpJson_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTota // Request is set to block for 6 seconds to allow the RPC to timeout. If retries are // disabled, the RPC timeout is set to be the totalTimeout (5s). @Test - public void + void testGRPC_unaryUnsuccessfulResponse_exceedsRPCTimeoutAndTotalTimeout_throwsDeadlineExceededException() throws Exception { RetrySettings defaultNoRetrySettings = @@ -227,7 +226,7 @@ public void testHttpJson_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTota // Request is set to block for 6 seconds to allow the RPC to timeout. If retries are // disabled, the RPC timeout is set to be the totalTimeout (5s). @Test - public void + void testHttpJson_unaryUnsuccessfulResponse_exceedsRPCTimeoutAndTotalTimeout_throwsDeadlineExceededException() throws Exception { RetrySettings defaultNoRetrySettings = @@ -274,9 +273,8 @@ public void testHttpJson_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTota // receive a response from the server (200ms) regardless of it was cancelled, then // we would expect at most 50 responses. @Test - public void - testGRPC_unaryCallableRetry_deadlineExecutorTimesOutRequest_throwsDeadlineExceededException() - throws Exception { + void testGRPC_unaryCallableRetry_deadlineExecutorTimesOutRequest_throwsDeadlineExceededException() + throws Exception { RetrySettings defaultRetrySettings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(100L)) @@ -324,7 +322,7 @@ public void testHttpJson_unarySuccessfulResponse_exceedsRPCDeadlineButWithinTota // receive a response from the server (200ms) regardless of it was cancelled, then // we would expect at most 50 responses. @Test - public void + void testHttpJson_unaryCallableRetry_deadlineExecutorTimesOutRequest_throwsDeadlineExceededException() throws Exception { RetrySettings defaultRetrySettings = From 7798da80b1803e3c89275f105d99efa97b609d7b Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 10 May 2024 10:39:23 +0000 Subject: [PATCH 11/17] update for new test after merge. --- .../v1beta1/it/ITApiVersionHeaders.java | 34 ++++++------ .../com/google/showcase/v1beta1/it/update.sh | 54 +++++++++++++++++++ 2 files changed, 71 insertions(+), 17 deletions(-) create mode 100755 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java index 7ef4019975..09ea03a38e 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java @@ -16,7 +16,7 @@ package com.google.showcase.v1beta1.it; 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.api.gax.httpjson.*; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -31,15 +31,15 @@ import java.io.IOException; import java.util.ArrayList; import java.util.concurrent.TimeUnit; -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; // TODO: add testing on error responses once feat is implemented in showcase. // https://github.com/googleapis/gapic-showcase/pull/1456 // TODO: watch for showcase gRPC trailer changes suggested in // https://github.com/googleapis/gapic-showcase/pull/1509#issuecomment-2089147103 -public class ITApiVersionHeaders { +class ITApiVersionHeaders { private static final String HTTP_RESPONSE_HEADER_STRING = "x-showcase-request-" + ApiClientHeaderProvider.API_VERSION_HEADER_KEY; private static final Metadata.Key API_VERSION_HEADER_KEY = @@ -158,8 +158,8 @@ public void onClose(int statusCode, HttpJsonMetadata trailers) { private ComplianceClient grpcComplianceClient; private ComplianceClient httpJsonComplianceClient; - @Before - public void createClients() throws Exception { + @BeforeEach + void createClients() throws Exception { // Create gRPC Interceptor and Client grpcInterceptor = new GrpcCapturingClientInterceptor(); grpcClient = TestClientInitializer.createGrpcEchoClient(ImmutableList.of(grpcInterceptor)); @@ -183,8 +183,8 @@ public void createClients() throws Exception { ImmutableList.of(httpJsonComplianceInterceptor)); } - @After - public void destroyClient() throws InterruptedException { + @AfterEach + void destroyClient() throws InterruptedException { grpcClient.close(); httpJsonClient.close(); grpcComplianceClient.close(); @@ -197,14 +197,14 @@ public void destroyClient() throws InterruptedException { } @Test - public void testGrpc_matchesApiVersion() { + void testGrpc_matchesApiVersion() { grpcClient.echo(EchoRequest.newBuilder().build()); String headerValue = grpcInterceptor.metadata.get(API_VERSION_HEADER_KEY); assertThat(headerValue).isEqualTo(EXPECTED_ECHO_API_VERSION); } @Test - public void testHttpJson_matchesHeaderName() { + void testHttpJson_matchesHeaderName() { httpJsonClient.echo(EchoRequest.newBuilder().build()); ArrayList headerValues = (ArrayList) httpJsonInterceptor.metadata.getHeaders().get(HTTP_RESPONSE_HEADER_STRING); @@ -213,7 +213,7 @@ public void testHttpJson_matchesHeaderName() { } @Test - public void testGrpc_noApiVersion() { + void testGrpc_noApiVersion() { RepeatRequest request = RepeatRequest.newBuilder().setInfo(ComplianceData.newBuilder().setFString("test")).build(); grpcComplianceClient.repeatDataSimplePath(request); @@ -221,7 +221,7 @@ public void testGrpc_noApiVersion() { } @Test - public void testHttpJson_noApiVersion() { + void testHttpJson_noApiVersion() { RepeatRequest request = RepeatRequest.newBuilder().setInfo(ComplianceData.newBuilder().setFString("test")).build(); httpJsonComplianceClient.repeatDataSimplePath(request); @@ -230,7 +230,7 @@ public void testHttpJson_noApiVersion() { } @Test - public void testGrpcEcho_userApiVersionThrowsException() throws IOException { + void testGrpcEcho_userApiVersionThrowsException() throws IOException { StubSettings stubSettings = grpcClient .getSettings() @@ -249,7 +249,7 @@ public void testGrpcEcho_userApiVersionThrowsException() throws IOException { } @Test - public void testHttpJsonEcho_userApiVersionThrowsException() throws IOException { + void testHttpJsonEcho_userApiVersionThrowsException() throws IOException { StubSettings stubSettings = httpJsonClient .getSettings() @@ -268,7 +268,7 @@ public void testHttpJsonEcho_userApiVersionThrowsException() throws IOException } @Test - public void testGrpcCompliance_userApiVersionSetSuccess() throws IOException { + void testGrpcCompliance_userApiVersionSetSuccess() throws IOException { StubSettings stubSettingsWithApiVersionHeader = grpcComplianceClient .getSettings() @@ -293,7 +293,7 @@ public void testGrpcCompliance_userApiVersionSetSuccess() throws IOException { } @Test - public void testHttpJsonCompliance_userApiVersionSetSuccess() throws IOException { + void testHttpJsonCompliance_userApiVersionSetSuccess() throws IOException { StubSettings httpJsonStubSettingsWithApiVersionHeader = httpJsonComplianceClient .getSettings() diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh new file mode 100755 index 0000000000..a3b598c4da --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +test_directory=$(pwd) + +find "$test_directory" -maxdepth 1 -type f -name "IT*.java" | while read file; do + + # Replace imports + sed -i 's/import org.junit.Test;/import org.junit.jupiter.api.Test;/g' "$file" + sed -i 's/import org.junit.Before;/import org.junit.jupiter.api.BeforeEach;/g' "$file" + sed -i 's/import org.junit.After;/import org.junit.jupiter.api.AfterEach;/g' "$file" + sed -i 's/import org.junit.BeforeClass;/import org.junit.jupiter.api.BeforeAll;/g' "$file" + sed -i 's/import org.junit.AfterClass;/import org.junit.jupiter.api.AfterAll;/g' "$file" + sed -i 's/import org.junit.Ignore;/import org.junit.jupiter.api.Disabled;/g' "$file" + sed -i 's/import org.junit.Assert;/import org.junit.jupiter.api.Assertions;/g' "$file" + sed -i 's/import static org.junit.Assert.assertEquals;/import static org.junit.jupiter.api.Assertions.assertEquals;/g' "$file" + sed -i 's/import static org.junit.Assert.assertTrue;/import static org.junit.jupiter.api.Assertions.assertTrue;/g' "$file" + sed -i 's/import static org.junit.Assert.assertNotSame;/import static org.junit.jupiter.api.Assertions.assertNotSame;/g' "$file" + sed -i 's/import static org.junit.Assert.assertThrows;/import static org.junit.jupiter.api.Assertions.assertThrows;/g' "$file" + + # Replace annotations (with potential whitespace variations and end-of-word check) + sed -i 's/@Test(timeout = 15000L)/@Test\n @Timeout(15)/g' "$file" + sed -i 's/@[[:space:]]*Before\b/@BeforeEach /g' "$file" # Added word boundary + sed -i 's/@[[:space:]]*After\b/@AfterEach /g' "$file" # Added word boundary + sed -i 's/@[[:space:]]*BeforeClass\b/@BeforeAll /g' "$file" # Added word boundary + sed -i 's/@[[:space:]]*AfterClass\b/@AfterAll /g' "$file" # Added word boundary + sed -i 's/@[[:space:]]*Ignore\b/@Disabled /g' "$file" # Added word boundary + + # Replace assertion methods (examples) + sed -i 's/Assert.assertEquals/Assertions.assertEquals/g' "$file" + sed -i 's/Assert.assertTrue/Assertions.assertTrue/g' "$file" + sed -i 's/Assert.assertFalse/Assertions.assertFalse/g' "$file" + sed -i 's/Assert.assertNull/Assertions.assertNull/g' "$file" + sed -i 's/Assert.assertNotNull/Assertions.assertNotNull/g' "$file" + sed -i 's/Assert.fail/Assertions.fail/g' "$file" + # Add more assertion replacements as needed + + # Replace ExpectedException rule (example) + sed -i 's/@Rule\n.*ExpectedException thrown.*/assertThrows(Exception.class, () -> {/g' "$file" + # Close the lambda function with a }); after the code that throws the exception + + sed -i 's/@Rule public TemporaryFolder/MANUAL CHANGES HERE!!/g' "$file" + + # Remove public modifiers + sed -i 's/public class /class /g' "$file" +# sed -i 's/public void /void /g' "$file" + # Remove public modifiers from test methods ONLY +# sed -i '/^[[:space:]]*@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)/ s/public void /void /g' "$file" +# sed -i -E 's/([[:space:]]+@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)[^\n]*)\n[[:space:]]+public[[:space:]]+void/\1\n void/g' "$file" +#perl -0777 -i -pe 's/(@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)(?:\s*\(.*?\))?\s*\n\s*)(static|final)?\s*public\s+(void\s+\w+\s*\((?:.*\n)*?\s*\)\s*(?:throws\s+\w+\s*)?\{)/$1$3$4/sg' "$file" +#perl -0777 -i -pe 's/(@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)(?:\s*\(.*?\))?\s*\n\s*)(static|final)?\s*public\s+void\s+(\w+)\s*\((?:.*\n)*?\s*\)(?:\s*throws\s+(.*?))?\s*\{/$1\n $3void $4($5) throws $6{/sg' "$file" + +done + +echo "JUnit 4 to JUnit 5 conversion completed for files in $test_directory" \ No newline at end of file From 3b851d9a2782cc88055eb659f9dac511834aacf8 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 17 May 2024 13:44:02 -0400 Subject: [PATCH 12/17] chore: Update showcase tests --- .../v1beta1/it/ITApiVersionHeaders.java | 42 ++++++++------- .../v1beta1/it/ITAutoPopulatedFields.java | 9 +++- .../v1beta1/it/ITDynamicRoutingHeaders.java | 35 +++++++----- .../com/google/showcase/v1beta1/it/update.sh | 54 ------------------- 4 files changed, 52 insertions(+), 88 deletions(-) delete mode 100755 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java index 09ea03a38e..5f892c5886 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITApiVersionHeaders.java @@ -31,8 +31,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.concurrent.TimeUnit; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; // TODO: add testing on error responses once feat is implemented in showcase. @@ -51,7 +51,6 @@ class ITApiVersionHeaders { private static final String EXPECTED_EXCEPTION_MESSAGE = "Header provider can't override the header: " + ApiClientHeaderProvider.API_VERSION_HEADER_KEY; - private static final int DEFAULT_AWAIT_TERMINATION_SEC = 10; // Implement a client interceptor to retrieve the trailing metadata from response. private static class GrpcCapturingClientInterceptor implements ClientInterceptor { @@ -149,17 +148,17 @@ public void onClose(int statusCode, HttpJsonMetadata trailers) { } } - private HttpJsonCapturingClientInterceptor httpJsonInterceptor; - private GrpcCapturingClientInterceptor grpcInterceptor; - private HttpJsonCapturingClientInterceptor httpJsonComplianceInterceptor; - private GrpcCapturingClientInterceptor grpcComplianceInterceptor; - private EchoClient grpcClient; - private EchoClient httpJsonClient; - private ComplianceClient grpcComplianceClient; - private ComplianceClient httpJsonComplianceClient; - - @BeforeEach - void createClients() throws Exception { + private static HttpJsonCapturingClientInterceptor httpJsonInterceptor; + private static GrpcCapturingClientInterceptor grpcInterceptor; + private static HttpJsonCapturingClientInterceptor httpJsonComplianceInterceptor; + private static GrpcCapturingClientInterceptor grpcComplianceInterceptor; + private static EchoClient grpcClient; + private static EchoClient httpJsonClient; + private static ComplianceClient grpcComplianceClient; + private static ComplianceClient httpJsonComplianceClient; + + @BeforeAll + static void createClients() throws Exception { // Create gRPC Interceptor and Client grpcInterceptor = new GrpcCapturingClientInterceptor(); grpcClient = TestClientInitializer.createGrpcEchoClient(ImmutableList.of(grpcInterceptor)); @@ -183,17 +182,20 @@ void createClients() throws Exception { ImmutableList.of(httpJsonComplianceInterceptor)); } - @AfterEach - void destroyClient() throws InterruptedException { + @AfterAll + static void destroyClient() throws InterruptedException { grpcClient.close(); httpJsonClient.close(); grpcComplianceClient.close(); httpJsonComplianceClient.close(); - grpcClient.awaitTermination(DEFAULT_AWAIT_TERMINATION_SEC, TimeUnit.SECONDS); - httpJsonClient.awaitTermination(DEFAULT_AWAIT_TERMINATION_SEC, TimeUnit.SECONDS); - grpcComplianceClient.awaitTermination(DEFAULT_AWAIT_TERMINATION_SEC, TimeUnit.SECONDS); - httpJsonComplianceClient.awaitTermination(DEFAULT_AWAIT_TERMINATION_SEC, TimeUnit.SECONDS); + grpcClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); + httpJsonClient.awaitTermination( + TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); + grpcComplianceClient.awaitTermination( + TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); + httpJsonComplianceClient.awaitTermination( + TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } @Test diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java index 3a2a68a1c0..f73b6b3c7d 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITAutoPopulatedFields.java @@ -157,10 +157,17 @@ void createClients() throws Exception { } @AfterEach - void destroyClient() { + void destroyClient() throws InterruptedException { grpcClientWithoutRetries.close(); grpcClientWithRetries.close(); httpJsonClient.close(); + + grpcClientWithoutRetries.awaitTermination( + TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); + grpcClientWithRetries.awaitTermination( + TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); + httpJsonClient.awaitTermination( + TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } @Test diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java index a1f34f5591..7828da8b53 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITDynamicRoutingHeaders.java @@ -45,7 +45,8 @@ import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -117,18 +118,18 @@ public void onClose(int statusCode, HttpJsonMetadata trailers) { } } - private HttpJsonCapturingClientInterceptor httpJsonInterceptor; - private HttpJsonCapturingClientInterceptor httpJsonComplianceInterceptor; - private GrpcCapturingClientInterceptor grpcInterceptor; - private GrpcCapturingClientInterceptor grpcComplianceInterceptor; + private static HttpJsonCapturingClientInterceptor httpJsonInterceptor; + private static HttpJsonCapturingClientInterceptor httpJsonComplianceInterceptor; + private static GrpcCapturingClientInterceptor grpcInterceptor; + private static GrpcCapturingClientInterceptor grpcComplianceInterceptor; - private EchoClient grpcClient; - private EchoClient httpJsonClient; - private ComplianceClient grpcComplianceClient; - private ComplianceClient httpJsonComplianceClient; + private static EchoClient grpcClient; + private static EchoClient httpJsonClient; + private static ComplianceClient grpcComplianceClient; + private static ComplianceClient httpJsonComplianceClient; - @BeforeEach - void createClients() throws Exception { + @BeforeAll + static void createClients() throws Exception { // Create gRPC Interceptor and Client grpcInterceptor = new GrpcCapturingClientInterceptor(); grpcClient = TestClientInitializer.createGrpcEchoClient(ImmutableList.of(grpcInterceptor)); @@ -153,8 +154,16 @@ void createClients() throws Exception { TestClientInitializer.createHttpJsonEchoClient(ImmutableList.of(httpJsonInterceptor)); } - @AfterEach - void destroyClient() throws InterruptedException { + @BeforeEach + void cleanUpParams() { + grpcInterceptor.metadata = null; + grpcComplianceInterceptor.metadata = null; + httpJsonInterceptor.requestParam = null; + httpJsonComplianceInterceptor.requestParam = null; + } + + @AfterAll + static void destroyClient() throws InterruptedException { grpcClient.close(); grpcComplianceClient.close(); diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh deleted file mode 100755 index a3b598c4da..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/update.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -test_directory=$(pwd) - -find "$test_directory" -maxdepth 1 -type f -name "IT*.java" | while read file; do - - # Replace imports - sed -i 's/import org.junit.Test;/import org.junit.jupiter.api.Test;/g' "$file" - sed -i 's/import org.junit.Before;/import org.junit.jupiter.api.BeforeEach;/g' "$file" - sed -i 's/import org.junit.After;/import org.junit.jupiter.api.AfterEach;/g' "$file" - sed -i 's/import org.junit.BeforeClass;/import org.junit.jupiter.api.BeforeAll;/g' "$file" - sed -i 's/import org.junit.AfterClass;/import org.junit.jupiter.api.AfterAll;/g' "$file" - sed -i 's/import org.junit.Ignore;/import org.junit.jupiter.api.Disabled;/g' "$file" - sed -i 's/import org.junit.Assert;/import org.junit.jupiter.api.Assertions;/g' "$file" - sed -i 's/import static org.junit.Assert.assertEquals;/import static org.junit.jupiter.api.Assertions.assertEquals;/g' "$file" - sed -i 's/import static org.junit.Assert.assertTrue;/import static org.junit.jupiter.api.Assertions.assertTrue;/g' "$file" - sed -i 's/import static org.junit.Assert.assertNotSame;/import static org.junit.jupiter.api.Assertions.assertNotSame;/g' "$file" - sed -i 's/import static org.junit.Assert.assertThrows;/import static org.junit.jupiter.api.Assertions.assertThrows;/g' "$file" - - # Replace annotations (with potential whitespace variations and end-of-word check) - sed -i 's/@Test(timeout = 15000L)/@Test\n @Timeout(15)/g' "$file" - sed -i 's/@[[:space:]]*Before\b/@BeforeEach /g' "$file" # Added word boundary - sed -i 's/@[[:space:]]*After\b/@AfterEach /g' "$file" # Added word boundary - sed -i 's/@[[:space:]]*BeforeClass\b/@BeforeAll /g' "$file" # Added word boundary - sed -i 's/@[[:space:]]*AfterClass\b/@AfterAll /g' "$file" # Added word boundary - sed -i 's/@[[:space:]]*Ignore\b/@Disabled /g' "$file" # Added word boundary - - # Replace assertion methods (examples) - sed -i 's/Assert.assertEquals/Assertions.assertEquals/g' "$file" - sed -i 's/Assert.assertTrue/Assertions.assertTrue/g' "$file" - sed -i 's/Assert.assertFalse/Assertions.assertFalse/g' "$file" - sed -i 's/Assert.assertNull/Assertions.assertNull/g' "$file" - sed -i 's/Assert.assertNotNull/Assertions.assertNotNull/g' "$file" - sed -i 's/Assert.fail/Assertions.fail/g' "$file" - # Add more assertion replacements as needed - - # Replace ExpectedException rule (example) - sed -i 's/@Rule\n.*ExpectedException thrown.*/assertThrows(Exception.class, () -> {/g' "$file" - # Close the lambda function with a }); after the code that throws the exception - - sed -i 's/@Rule public TemporaryFolder/MANUAL CHANGES HERE!!/g' "$file" - - # Remove public modifiers - sed -i 's/public class /class /g' "$file" -# sed -i 's/public void /void /g' "$file" - # Remove public modifiers from test methods ONLY -# sed -i '/^[[:space:]]*@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)/ s/public void /void /g' "$file" -# sed -i -E 's/([[:space:]]+@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)[^\n]*)\n[[:space:]]+public[[:space:]]+void/\1\n void/g' "$file" -#perl -0777 -i -pe 's/(@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)(?:\s*\(.*?\))?\s*\n\s*)(static|final)?\s*public\s+(void\s+\w+\s*\((?:.*\n)*?\s*\)\s*(?:throws\s+\w+\s*)?\{)/$1$3$4/sg' "$file" -#perl -0777 -i -pe 's/(@(Test|BeforeEach|AfterEach|BeforeAll|AfterAll|Disabled)(?:\s*\(.*?\))?\s*\n\s*)(static|final)?\s*public\s+void\s+(\w+)\s*\((?:.*\n)*?\s*\)(?:\s*throws\s+(.*?))?\s*\{/$1\n $3void $4($5) throws $6{/sg' "$file" - -done - -echo "JUnit 4 to JUnit 5 conversion completed for files in $test_directory" \ No newline at end of file From 13b2a8c7251f5a08996d9c2a9ae6ee48aa411c74 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 17 May 2024 14:42:41 -0400 Subject: [PATCH 13/17] chore: Use junit-platform for failsure plugin --- showcase/gapic-showcase/pom.xml | 5 ----- showcase/pom.xml | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/showcase/gapic-showcase/pom.xml b/showcase/gapic-showcase/pom.xml index 1fb08aaf05..e8022b5328 100644 --- a/showcase/gapic-showcase/pom.xml +++ b/showcase/gapic-showcase/pom.xml @@ -131,11 +131,6 @@ - - org.junit.platform - junit-platform-launcher - test - org.junit.jupiter junit-jupiter-engine diff --git a/showcase/pom.xml b/showcase/pom.xml index 947818e182..7618aa74f4 100644 --- a/showcase/pom.xml +++ b/showcase/pom.xml @@ -117,6 +117,13 @@ org.apache.maven.plugins maven-failsafe-plugin + + + org.apache.maven.surefire + surefire-junit-platform + ${surefire.version} + + org.codehaus.mojo From 4efa34a17a121fe6e6dc389518d49cd65c7302f8 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 17 May 2024 15:07:14 -0400 Subject: [PATCH 14/17] chore: Add comment for Override Junit version for failsafe --- .../src/test/java/com/google/showcase/v1beta1/it/ITGdch.java | 3 +-- showcase/pom.xml | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java index fbc3fd8083..f043d45cfc 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITGdch.java @@ -41,7 +41,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.URI; -import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; @@ -75,7 +74,7 @@ class ITGdch { private URI tokenUri; @BeforeEach - void setup(@TempDir Path tempDir) throws IOException, URISyntaxException { + void setup(@TempDir Path tempDir) throws IOException { transportFactory = new InterceptingMockTokenServerTransportFactory(); prepareCredentials(tempDir); settings = diff --git a/showcase/pom.xml b/showcase/pom.xml index 7618aa74f4..cb17baaa68 100644 --- a/showcase/pom.xml +++ b/showcase/pom.xml @@ -117,6 +117,8 @@ org.apache.maven.plugins maven-failsafe-plugin + + org.apache.maven.surefire From ebd24c507e77c60157755713c256080bb51be708 Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 17 May 2024 15:18:12 -0400 Subject: [PATCH 15/17] chore: Remove public scope for parameterized test --- .../java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java index a8197396f4..3b73d7e5b6 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITHttpAnnotation.java @@ -52,7 +52,7 @@ // tests the product of the rpc list and requests list. class ITHttpAnnotation { - public static Stream data() { + static Stream data() { return Stream.of( Arguments.of("Fully working conversions, resources"), Arguments.of("Binding selection testing"), From b3443301cdaa94078632d2065c9b64b66075b5bd Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 17 May 2024 15:39:59 -0400 Subject: [PATCH 16/17] chore: Address PR comments --- .../v1beta1/it/ITServerSideStreaming.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java index 8439e19411..aecf0e304a 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java @@ -34,10 +34,10 @@ import io.grpc.ManagedChannelBuilder; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -146,17 +146,18 @@ void testGrpc_serverWaitTimeout_watchdogCancelsStream() throws Exception { .setStreamWaitTime( com.google.protobuf.Duration.newBuilder().setSeconds(1).build()) .build()); - ArrayList responses = new ArrayList<>(); - try { - for (EchoResponse response : responseStream) { - responses.add(response.getContent()); - } - Assertions.fail("No exception was thrown"); - } catch (WatchdogTimeoutException e) { - assertThat(e).hasMessageThat().contains("Canceled due to timeout waiting for next response"); - } finally { - echoClient.close(); - } + List responses = new ArrayList<>(); + WatchdogTimeoutException exception = + assertThrows( + WatchdogTimeoutException.class, + () -> { + responseStream.forEach(x -> responses.add(x.getContent())); + }); + assertThat(exception) + .hasMessageThat() + .contains("Canceled due to timeout waiting for next response"); + echoClient.close(); + echoClient.awaitTermination(TestClientInitializer.AWAIT_TERMINATION_SECONDS, TimeUnit.SECONDS); } @Test From 73c17ad92d0e5105e91383e72bd77ba5a0660bce Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Fri, 17 May 2024 15:40:47 -0400 Subject: [PATCH 17/17] chore: Fix lint issues --- .../com/google/showcase/v1beta1/it/ITServerSideStreaming.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java index aecf0e304a..9d9ccba39e 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITServerSideStreaming.java @@ -150,9 +150,7 @@ void testGrpc_serverWaitTimeout_watchdogCancelsStream() throws Exception { WatchdogTimeoutException exception = assertThrows( WatchdogTimeoutException.class, - () -> { - responseStream.forEach(x -> responses.add(x.getContent())); - }); + () -> responseStream.forEach(x -> responses.add(x.getContent()))); assertThat(exception) .hasMessageThat() .contains("Canceled due to timeout waiting for next response");