Jackeyzhe opened a new pull request, #7535:
URL: https://github.com/apache/gravitino/pull/7535
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): support xxx"
- "[#233] fix: check null before access result in xxx"
- "[MINOR] refactor: fix typo in variable name"
- "[MINOR] docs: fix typo in README"
- "[#255] test: fix flaky test NameOfTheTest"
Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->
### What changes were proposed in this pull request?
Valid input string for fromString in Namespace.java
### Why are the changes needed?
Ensure that converting a string to a namespace validates all input
Fix: #7516
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
(Please test your changes, and provide instructions on how to test it:
add these tests
``` java
@Test
public void testFromString() {
Assertions.assertEquals(Namespace.empty(), Namespace.fromString(""));
Assertions.assertEquals(Namespace.of("a", "b"),
Namespace.fromString("a.b"));
Assertions.assertEquals(Namespace.of("a"), Namespace.fromString("a"));
}
@Test
public void testFromStringInvalidArgs() {
Assertions.assertThrows(IllegalArgumentException.class, () ->
Namespace.fromString(null));
Assertions.assertThrows(IllegalArgumentException.class, () ->
Namespace.fromString(".a"));
Assertions.assertThrows(IllegalArgumentException.class, () ->
Namespace.fromString("a."));
Assertions.assertThrows(IllegalArgumentException.class, () ->
Namespace.fromString("a..b"));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]