From 5edeac28df5bba67b28ed15ca26c9c6c89b5b3f7 Mon Sep 17 00:00:00 2001 From: Krishna Anandan Date: Tue, 14 Nov 2023 10:07:19 -0600 Subject: [PATCH] + Switching Comparison from String to JSON (#15364) --- .../histogram/ApproximateHistogramAggregatorTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregatorTest.java b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregatorTest.java index e1a1b6c6b867..cc7d876f9f3d 100644 --- a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregatorTest.java +++ b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregatorTest.java @@ -19,6 +19,7 @@ package org.apache.druid.query.aggregation.histogram; +import com.fasterxml.jackson.databind.JsonNode; import org.apache.druid.jackson.DefaultObjectMapper; import org.apache.druid.java.util.common.granularity.Granularities; import org.apache.druid.query.Druids; @@ -106,14 +107,12 @@ public void testFinalize() throws Exception ApproximateHistogramAggregator agg = new ApproximateHistogramAggregator(selector, resolution, 0, 100); agg.aggregate(); - Object finalizedObjectHumanReadable = humanReadableFactory.finalizeComputation(agg.get()); String finalStringHumanReadable = objectMapper.writeValueAsString(finalizedObjectHumanReadable); - Assert.assertEquals( - "{\"breaks\":[23.0,23.0,23.0,23.0,23.0,23.0],\"counts\":[0.0,0.0,0.0,0.0,0.0]}", - finalStringHumanReadable - ); - + JsonNode expectedJson = objectMapper.readTree( + "{\"breaks\":[23.0,23.0,23.0,23.0,23.0,23.0],\"counts\":[0.0,0.0,0.0,0.0,0.0]}"); + JsonNode actualJson = objectMapper.readTree(finalStringHumanReadable); + Assert.assertEquals(expectedJson, actualJson); Object finalizedObjectBinary = binaryFactory.finalizeComputation(agg.get()); String finalStringBinary = objectMapper.writeValueAsString(finalizedObjectBinary); Assert.assertEquals(