Created
November 18, 2016 15:17
-
-
Save elucidator/46449671792368343b69dfdd2276f8fb to your computer and use it in GitHub Desktop.
Partial test case for KV parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String INPUT = "key=\"value\" withEqualsSign=\"Base64==\" isEmpty=\"\" withSpaces=\" s p a c e s \" withEscapeChar=\"aaa\\\\bbb\" withEscapeChar2=\"aaa\\\"bbb\" withEscapeChar3=\"aaa\\]bbb\""; | |
@Test | |
public void variousVariations() throws Exception { | |
final List<Map.Entry<String, String>> collect = KeyValueReaderIterable.stream(INPUT).collect(Collectors.toList()); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("key", "value"))); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("withEqualsSign", "Base64=="))); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("isEmpty", ""))); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("withSpaces", " s p a c e s "))); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("withEscapeChar", "aaa\\\\bbb"))); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("withEscapeChar2", "aaa\\\"bbb"))); | |
assertThat(collect, hasItem(new AbstractMap.SimpleEntry<>("withEscapeChar3", "aaa\\]bbb"))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment