From ec21a3b4f8e64f4a4718c12a63eca81c6271d1cb Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Tue, 29 Oct 2024 13:01:57 -0400 Subject: [PATCH] add comment and add assert to test to verify correct methods included. --- .../google/api/generator/gapic/protoparser/ParserTest.java | 3 +++ .../src/test/proto/selective_api_generation.proto | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/ParserTest.java b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/ParserTest.java index 874c42d6ef..c3a5aa55ff 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/ParserTest.java +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/ParserTest.java @@ -760,6 +760,9 @@ void selectiveGenerationTest_shouldGenerateOnlySelectiveMethods() { assertEquals(1, services.size()); assertEquals("EchoServiceShouldGeneratePartial", services.get(0).overriddenName()); assertEquals(3, services.get(0).methods().size()); + for (Method method : services.get(0).methods()) { + assertTrue(method.name().contains("ShouldInclude")); + } } @Test diff --git a/gapic-generator-java/src/test/proto/selective_api_generation.proto b/gapic-generator-java/src/test/proto/selective_api_generation.proto index 6f194b3a63..06da2c2e41 100644 --- a/gapic-generator-java/src/test/proto/selective_api_generation.proto +++ b/gapic-generator-java/src/test/proto/selective_api_generation.proto @@ -92,7 +92,9 @@ message Foobar { string info = 2; } -// resource name used for message EchoRequestWithFoobarbaz. +// resource name used only for message EchoRequestWithFoobarbaz. +// should not be generated with selective generation when +// AnExcludedMethod is not config as included. message Foobarbaz { option (google.api.resource) = { type: "showcase.googleapis.com/Foobarbaz"