Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix failing unit tests in PathTemplateTest #2823

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.util.Set;
import java.util.stream.Stream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -302,7 +301,6 @@ void complexResourceIdEqualsWildcard() {
}

@Test
@Disabled("https://github.com/googleapis/sdk-platform-java/issues/2778")
void complexResourceIdEqualsPathWildcard() {
Exception exception =
Assertions.assertThrows(
Expand All @@ -312,15 +310,6 @@ void complexResourceIdEqualsPathWildcard() {
String.format(
"parse error: wildcard path not allowed in complex ID resource '%s'", "zone_a"),
exception.getMessage());

exception =
Assertions.assertThrows(
ValidationException.class,
() -> PathTemplate.create("projects/{project=*}/zones/{zone_a}.{zone_b=**}"));
Assertions.assertEquals(
String.format(
"parse error: wildcard path not allowed in complex ID resource '%s'", "zone_b"),
exception.getMessage());
}

@Test
Expand Down Expand Up @@ -360,9 +349,18 @@ void complexResourceIdNoSeparator() {
"parse error: missing or 2+ consecutive delimiter characters in '%s'",
"{zone_a}_{zone_b}{zone_c}"),
exception.getMessage());

exception =
Assertions.assertThrows(
ValidationException.class,
() -> PathTemplate.create("projects/{project=*}/zones/{zone_a}{{zone_b}"));
Assertions.assertEquals(
String.format(
"parse error: missing or 2+ consecutive delimiter characters in '%s'",
"{zone_a}{{zone_b}"),
exception.getMessage());
}

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

static Stream<String> invalidDelimiters() {
return Stream.of("|", "!", "@", "a", "1", ",", "{", ")");
return Stream.of("|", "!", "@", "a", "1", ",", ")");
}

@Test
Expand Down
Loading