Skip to content

Commit

Permalink
allow = in parameter values.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsuya Niwa committed Nov 27, 2019
1 parent 02018d2 commit b1e7c82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Map<String, String> parse(String nameValuePairFormattedString) {
//the default splitter message in this scenario is not user friendly, so snip a trailing semicolon
clean = clean.substring(0, clean.length() - 1);
}
return Splitter.on(PAIR_SEPARATOR).trimResults().withKeyValueSeparator(NAME_VALUE_SEPARATOR).split(clean);
return Splitter.on(PAIR_SEPARATOR).trimResults().withKeyValueSeparator(Splitter.on(NAME_VALUE_SEPARATOR).limit(2)).split(clean);
}

public String checkSanity(String cronTabSpec, ParametersDefinitionProperty parametersDefinitionProperty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ public void test_TwoParamsStringWithSpaceReturns_emptyMap() {
assertEquals(expected, testObject.parse("name2=value2; name=value"));
}

@Test
public void test_ValueContainsEquals_emptyMap() {
ParameterParser testObject = new ParameterParser();

HashMap<String, String> expected = new HashMap<String, String>();
expected.put("name", "value=contains=equals");
assertEquals(expected, testObject.parse("name=value=contains=equals"));
}

@Test
public void checkSanity_HappyPath() throws Exception {
ParameterParser testObject = new ParameterParser();
Expand Down

0 comments on commit b1e7c82

Please sign in to comment.