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

api-common-java/src/test/java/com/google/api/pathtemplate/PathTemplateTest.complexResourceIdEqualsPathWildcard test erroneously succeeding #2778

Closed
alicejli opened this issue May 16, 2024 · 1 comment · Fixed by #2823
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@alicejli
Copy link
Contributor

https://github.com/googleapis/sdk-platform-java/blob/v2.40.0/api-common-java/src/test/java/com/google/api/pathtemplate/PathTemplateTest.java#L310

@Test
  public void complexResourceIdEqualsPathWildcard() {
    thrown.expect(ValidationException.class);
    PathTemplate template = PathTemplate.create("projects/{project=*}/zones/{zone_a=**}~{zone_b}");
    thrown.expectMessage(
        String.format(
            "parse error: wildcard path not allowed in complex ID resource '%s'", "zone_a"));

    template = PathTemplate.create("projects/{project=*}/zones/{zone_a}.{zone_b=**}");
    thrown.expectMessage(
        String.format(
            "parse error: wildcard path not allowed in complex ID resource '%s'", "zone_b"));
  }

The first template throws the exception as expected and causes the whole test to pass. However, the second template actually does not throw any exception. Either the test needs to be rewritten or he code needs to be refactored to fix this bug.

@lqiu96 lqiu96 added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels May 21, 2024
@blakeli0
Copy link
Collaborator

Delete the second case should be good enough for now, since it never worked.

@blakeli0 blakeli0 added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels May 21, 2024
@JoeWang1127 JoeWang1127 self-assigned this May 27, 2024
@JoeWang1127 JoeWang1127 linked a pull request May 27, 2024 that will close this issue
JoeWang1127 added a commit that referenced this issue May 28, 2024
Fix #2776 and #2778.

The failing tests are in the same file, thus combine into one pull
request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants