Skip to content

Commit

Permalink
Sort order for JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Mar 28, 2024
1 parent 6afb865 commit b355016
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.opentripplanner.standalone.config.framework.json.JsonSupport;

public class JsonAssertions {

private static final ObjectMapper MAPPER = new ObjectMapper();

static {
MAPPER.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
//MAPPER.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
}

/**
Expand All @@ -32,8 +31,9 @@ public static void assertEqualJson(String expected, String actual) {
*/
public static void assertEqualJson(String expected, JsonNode actual) {
try {
var actualNode = MAPPER.readTree(actual.toString());
var exp = MAPPER.readTree(expected);
assertEquals(JsonSupport.prettyPrint(exp), JsonSupport.prettyPrint(actual));
assertEquals(exp, actualNode, () -> "Expected '%s' but actual was '%s'".formatted(JsonSupport.prettyPrint(exp), JsonSupport.prettyPrint(actualNode)));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,6 @@
}
}
],
"version" : 8,
"glyphs" : "https://cdn.jsdelivr.net/gh/klokantech/klokantech-gl-fonts@master/{fontstack}/{range}.pbf"
"glyphs" : "https://cdn.jsdelivr.net/gh/klokantech/klokantech-gl-fonts@master/{fontstack}/{range}.pbfi",
"version" : 8
}

0 comments on commit b355016

Please sign in to comment.