Skip to content

Commit

Permalink
Added tests for function parseCommaSeparatedStringMapFromString with …
Browse files Browse the repository at this point in the history
…valid and invalid JSON arguments
  • Loading branch information
elijahgrimaldi committed Nov 3, 2023
1 parent ff7de17 commit cec72b6
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,21 @@ public void testParseMap() {
public void testSanitizingStringForLogger() {
Assert.assertEquals(Utils.getSanitizedStringForLogger(".abc.123."), "_abc_123_");
}

@Test
public void testParseCommaSeparatedStringMapFromString() {
try {
Utils.parseCommaSeparatedStringMapFromString(
"{\"changeCaptureView\": {\"viewClassName\": \"com.linkedin.venice.views.ChangeCaptureView\",\"params\": {}}}",
"someField"); // Method that should not throw an exception
} catch (Exception e) {
fail("Expected no exception to be thrown, but got: " + e.getMessage());
}

Assert.assertThrows(
VeniceException.class,
() -> Utils.parseCommaSeparatedStringMapFromString(
"{\"changeCaptureView\": {\"viewClassName\": \"com.linkedin.venice.views.ChangeCaptureView\",\"params\":",
"someField"));
}
}

0 comments on commit cec72b6

Please sign in to comment.