Created
July 21, 2015 10:56
-
-
Save CDRussell/2bde5d6f6924a5c16e69 to your computer and use it in GitHub Desktop.
Asserts that two Strings containing JSON are equal.
This file contains hidden or 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
public static void assertEqualsJson(String expected, String actual) throws IOException { | |
ObjectMapper objectMapper = new ObjectMapper(); | |
assertEquals(objectMapper.readTree(expected), objectMapper.readTree(actual)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Equality means that the keys and values are equal; this deliberately ignores comparing whitespace and order of elements.
Requires com.fasterxml.jackson.