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

Add support for = in parameter values. #52

Merged
merged 1 commit into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
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