Change isSerializedTo to check for Jackson serialization

This commit is contained in:
Antonin Delpeuch 2018-09-23 11:05:08 +01:00
parent 36765e7e62
commit e661a647f3

View File

@ -7,6 +7,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Properties;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -52,6 +53,14 @@ public class TestUtils {
*/
public static void isSerializedTo(Jsonizable o, String targetJson, Properties options) {
equalAsJson(targetJson, JSONUtilities.serialize(o, options));
// also check Jackson serialization
try {
equalAsJson(targetJson, mapper.writeValueAsString(o));
} catch (JsonProcessingException e) {
e.printStackTrace();
fail("jackson serialization failed");
}
}
/**