From 6afb8652c01501c9756aec06079dea332ab21ba8 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 28 Mar 2024 13:48:20 +0100 Subject: [PATCH] Sort by keys before comparing --- .../org/opentripplanner/test/support/JsonAssertions.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/org/opentripplanner/test/support/JsonAssertions.java b/src/test/java/org/opentripplanner/test/support/JsonAssertions.java index 2dab1e96190..f57e5a6741d 100644 --- a/src/test/java/org/opentripplanner/test/support/JsonAssertions.java +++ b/src/test/java/org/opentripplanner/test/support/JsonAssertions.java @@ -5,12 +5,17 @@ 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); + } + /** * Take two JSON documents and reformat them before comparing {@code actual} with {@code expected}. */