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

633 - fix backslack comma behaviour #643

Merged
merged 2 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions spec/src/main/asciidoc/configexamples.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ The table below defines the conversion rules, including some special edge case s
| "\,"
| String[]
| getValue
| throws `NoSuchElementException`
| {","}


| "\,"
Expand All @@ -335,12 +335,12 @@ The table below defines the conversion rules, including some special edge case s
| "\,"
| String[]
| getOptionalValue
| Optional.empty()
| Optional.of({","})

| "\,"
| String
| getOptionalValues
| Optional.empty()
| Optional.of(List.of(","))

| ",,"
| String
Expand Down
2 changes: 1 addition & 1 deletion spec/src/main/asciidoc/release_notes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ previous behaviour.
- Empty value or other special characters are no longer a valid config value for a particular return type. Refer to the earlier section of this spec for more details.
In the previous release, the empty value was returned as an empty value. From now on, the empty value will cause `NoSuchElementException` to be thrown.
(link:https://github.com/eclipse/microprofile-config/issues/446[446]) (link:https://github.com/eclipse/microprofile-config/issues/531[531])
(link:https://github.com/eclipse/microprofile-config/issues/532[532]) (link:https://github.com/eclipse/microprofile-config/issues/397[397])
(link:https://github.com/eclipse/microprofile-config/issues/532[532]) (link:https://github.com/eclipse/microprofile-config/issues/397[397]) (link:https://github.com/eclipse/microprofile-config/issues/633[633])

=== API/SPI Changes
- Convenience methods have been added to Config allowing for the retrieval of multi-valued properties as lists instead of arrays (link:https://github.com/eclipse/microprofile-config/issues/496[#496])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ public void testCommaStringGetOptionalValue() {
assertConfigurationNotPresentForOptionalMultiple("comma.string");
}

@Test(expectedExceptions = NoSuchElementException.class)
@Test
public void testBackslashCommaStringGetValueArray() {
String[] values = config.getValue("backslash.comma.string", String[].class);
Assert.assertEquals(values, new String[]{","});

}

@Test
Expand All @@ -120,6 +122,12 @@ public void testBackslashCommaStringGetValue() {
Assert.assertEquals(value, "\\,");
}

@Test
public void testBackslashCommaStringGetOptionalValueAsArrayorList() {
Emily-Jiang marked this conversation as resolved.
Show resolved Hide resolved
Assert.assertEquals(config.getOptionalValue("backslash.comma.string", String[].class).get(), new String[]{","});
Assert.assertEquals(config.getOptionalValues("backslash.comma.string", String.class).get(), Arrays.asList(","));
}

@Test
public void testBackslashCommaStringGetOptionalValue() {
Assert.assertEquals(config.getOptionalValue("backslash.comma.string", String.class).get(), "\\,");
Expand Down