diff --git a/processing/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java b/processing/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java index 39b55596ca00..62244d3bd288 100644 --- a/processing/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java +++ b/processing/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java @@ -240,12 +240,14 @@ protected ListenableFuture go(Request request) throws JsonProcessingEx request.getHeaders().get(HttpHeaders.Names.CONTENT_TYPE) ); Assert.assertEquals( - StringUtils.format( + JSON_MAPPER.readTree(StringUtils.format( "[%s,%s]\n", JSON_MAPPER.writeValueAsString(events.get(0)), JSON_MAPPER.writeValueAsString(events.get(1)) - ), - StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + )), + JSON_MAPPER.readTree( + StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + ) ); return GoHandlers.immediateFuture(okResponse()); @@ -282,12 +284,14 @@ protected ListenableFuture go(Request request) throws JsonProcessingEx request.getHeaders().get(HttpHeaders.Names.CONTENT_TYPE) ); Assert.assertEquals( - StringUtils.format( + JSON_MAPPER.readTree(StringUtils.format( "[%s,%s]\n", JSON_MAPPER.writeValueAsString(events.get(0)), JSON_MAPPER.writeValueAsString(events.get(1)) - ), - StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + )), + JSON_MAPPER.readTree( + StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + ) ); return GoHandlers.immediateFuture(okResponse()); @@ -467,12 +471,14 @@ protected ListenableFuture go(Request request) throws JsonProcessingEx request.getHeaders().get(HttpHeaders.Names.AUTHORIZATION) ); Assert.assertEquals( - StringUtils.format( + JSON_MAPPER.readTree(StringUtils.format( "%s\n%s\n", JSON_MAPPER.writeValueAsString(events.get(0)), JSON_MAPPER.writeValueAsString(events.get(1)) - ), - StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + )), + JSON_MAPPER.readTree( + StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + ) ); return GoHandlers.immediateFuture(okResponse()); @@ -521,12 +527,14 @@ protected ListenableFuture go(Request request) throws JsonProcessingEx request.getHeaders().get(HttpHeaders.Names.CONTENT_TYPE) ); Assert.assertEquals( - StringUtils.format( + JSON_MAPPER.readTree(StringUtils.format( "[%s,%s]\n", JSON_MAPPER.writeValueAsString(events.get(counter.getAndIncrement())), JSON_MAPPER.writeValueAsString(events.get(counter.getAndIncrement())) - ), - StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + )), + JSON_MAPPER.readTree( + StandardCharsets.UTF_8.decode(request.getByteBufferData().slice()).toString() + ) ); return GoHandlers.immediateFuture(okResponse()); @@ -584,12 +592,14 @@ protected ListenableFuture go(Request request) throws IOException CompressionUtils.gunzip(new ByteArrayInputStream(dataArray), baos); Assert.assertEquals( - StringUtils.format( + JSON_MAPPER.readTree(StringUtils.format( "[%s,%s]\n", JSON_MAPPER.writeValueAsString(events.get(0)), JSON_MAPPER.writeValueAsString(events.get(1)) - ), + )), + JSON_MAPPER.readTree( baos.toString(StandardCharsets.UTF_8.name()) + ) ); return GoHandlers.immediateFuture(okResponse()); diff --git a/processing/src/test/java/org/apache/druid/java/util/emitter/core/ParametrizedUriEmitterTest.java b/processing/src/test/java/org/apache/druid/java/util/emitter/core/ParametrizedUriEmitterTest.java index f7d7a8337a20..c5dc26432fe0 100644 --- a/processing/src/test/java/org/apache/druid/java/util/emitter/core/ParametrizedUriEmitterTest.java +++ b/processing/src/test/java/org/apache/druid/java/util/emitter/core/ParametrizedUriEmitterTest.java @@ -155,7 +155,9 @@ protected ListenableFuture go(Request request) "http://example.com/test1", StringUtils.format("[%s]\n", JSON_MAPPER.writeValueAsString(events.get(0))), "http://example.com/test2", StringUtils.format("[%s]\n", JSON_MAPPER.writeValueAsString(events.get(1))) ); - Assert.assertEquals(expected, results); + for (Map.Entry entry : expected.entrySet()) { + Assert.assertEquals(JSON_MAPPER.readTree(expected.get(entry.getKey())), JSON_MAPPER.readTree(results.get(entry.getKey()))); + } } @Test