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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]