Skip to content

Commit b5e8744

Browse files
authored
chore: fix failing unit tests in PathTemplateTest (#2823)
Fix #2776 and #2778. The failing tests are in the same file, thus combine into one pull request.
1 parent 5d6b43e commit b5e8744

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

sdk-platform-java/api-common-java/src/test/java/com/google/api/pathtemplate/PathTemplateTest.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.util.Set;
3737
import java.util.stream.Stream;
3838
import org.junit.jupiter.api.Assertions;
39-
import org.junit.jupiter.api.Disabled;
4039
import org.junit.jupiter.api.Test;
4140
import org.junit.jupiter.params.ParameterizedTest;
4241
import org.junit.jupiter.params.provider.MethodSource;
@@ -302,7 +301,6 @@ void complexResourceIdEqualsWildcard() {
302301
}
303302

304303
@Test
305-
@Disabled("https://github.com/googleapis/sdk-platform-java/issues/2778")
306304
void complexResourceIdEqualsPathWildcard() {
307305
Exception exception =
308306
Assertions.assertThrows(
@@ -312,15 +310,6 @@ void complexResourceIdEqualsPathWildcard() {
312310
String.format(
313311
"parse error: wildcard path not allowed in complex ID resource '%s'", "zone_a"),
314312
exception.getMessage());
315-
316-
exception =
317-
Assertions.assertThrows(
318-
ValidationException.class,
319-
() -> PathTemplate.create("projects/{project=*}/zones/{zone_a}.{zone_b=**}"));
320-
Assertions.assertEquals(
321-
String.format(
322-
"parse error: wildcard path not allowed in complex ID resource '%s'", "zone_b"),
323-
exception.getMessage());
324313
}
325314

326315
@Test
@@ -360,9 +349,18 @@ void complexResourceIdNoSeparator() {
360349
"parse error: missing or 2+ consecutive delimiter characters in '%s'",
361350
"{zone_a}_{zone_b}{zone_c}"),
362351
exception.getMessage());
352+
353+
exception =
354+
Assertions.assertThrows(
355+
ValidationException.class,
356+
() -> PathTemplate.create("projects/{project=*}/zones/{zone_a}{{zone_b}"));
357+
Assertions.assertEquals(
358+
String.format(
359+
"parse error: missing or 2+ consecutive delimiter characters in '%s'",
360+
"{zone_a}{{zone_b}"),
361+
exception.getMessage());
363362
}
364363

365-
@Disabled("https://github.com/googleapis/sdk-platform-java/issues/2776")
366364
@ParameterizedTest
367365
@MethodSource("invalidDelimiters")
368366
void complexResourceIdInvalidDelimiter(String invalidDelimiter) {
@@ -381,7 +379,7 @@ void complexResourceIdInvalidDelimiter(String invalidDelimiter) {
381379
}
382380

383381
static Stream<String> invalidDelimiters() {
384-
return Stream.of("|", "!", "@", "a", "1", ",", "{", ")");
382+
return Stream.of("|", "!", "@", "a", "1", ",", ")");
385383
}
386384

387385
@Test

0 commit comments

Comments
 (0)