You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/10/25 14:34:43 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6526: NIFI-10630 Fixed Possible Json Ordering Permutations Problem in Tests

exceptionfactory commented on code in PR #6526:
URL: https://github.com/apache/nifi/pull/6526#discussion_r1004568955


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWaitNotifyProtocol.java:
##########
@@ -104,8 +105,10 @@ public void testNotifyFirst() throws Exception {
 
         final AtomicCacheEntry<String, String, Long> cacheEntry = cacheEntries.get("signal-id");
 
+        ObjectMapper mapper = new ObjectMapper();

Review Comment:
   The `ObjectMapper` instance can be created as a static variable and reused in all methods.



##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWaitNotifyProtocol.java:
##########
@@ -104,8 +105,10 @@ public void testNotifyFirst() throws Exception {
 
         final AtomicCacheEntry<String, String, Long> cacheEntry = cacheEntries.get("signal-id");
 
+        ObjectMapper mapper = new ObjectMapper();
         assertEquals(1, cacheEntry.getRevision().orElse(-1L).longValue());
-        assertEquals("{\"counts\":{\"a\":1},\"attributes\":{},\"releasableCount\":0}", cacheEntry.getValue());
+        assertEquals(mapper.readTree("{\"counts\":{\"a\":1},\"attributes\":{},\"releasableCount\":0}"),
+        mapper.readTree(cacheEntry.getValue()));

Review Comment:
   Instead of repeating `mapper.readTree()` for the expected and cached values, it would be helpful to create a new method named `assertValueEquals(String expected, String value)` and then call `mapper.readTree()` in that method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org