demery-pivotal commented on code in PR #7608:
URL: https://github.com/apache/geode/pull/7608#discussion_r858935550


##########
geode-core/src/distributedTest/java/org/apache/geode/cache/client/ClientServerRegisterInterestsDUnitTest.java:
##########
@@ -224,27 +205,27 @@ public void testClientRegisterInterests() {
       Region<String, String> example = clientCache.getRegion(SEPARATOR + 
"Example");
 
       assertNotNull("'Example' Region in Client Cache was not found!", 
example);
-      assertEquals(1, example.size());
+      assertThat(example.size()).isEqualTo(1);
       assertTrue(example.containsKey("1"));
-      assertEquals("ONE", example.get("1"));
+      assertThat(example.get("1")).isEqualTo("ONE");

Review Comment:
   If I were diagnosing a failure of this test, I would want all of this 
important information:
   - The entire content of the map.
   - What the test expected about the content.
   - Which expected entries were missing.
   - Which existing entries were unexpected.
   
   In this sequence of assertions:
   ```
   assertThat(example.size()).isEqualTo(2);
   assertThat(example.get("1")).isEqualTo("ONE");
   assertTrue(example.containsKey("2"));
   assertThat(example.get("2")).isEqualTo("TWO");
   ```
   If the first assertion fails, I have NO way to know the content of the map.
   
   If the second assertion fails, I have NO way to know either the key or the 
value of the other entry.
   
   If the third assertion fails, the failure message tells me only that 
something wasn’t true. I have NO way to know either the key or the value of the 
other entry.
   
   Some of the information I want is available not in the failure message, and 
not in the source code, but only in memory while the test is running.
   
   If any of those first three assertions fails, the assertion exits the test, 
discarding useful diagnostic information without reporting it.
   
   If I were diagnosing a failure of this test, I would quite annoyed to 
discover that not only did the author not give me the information I want, but 
actually insisted that I not have it.
   
   The assertion that Jake and I are asking for gives me all of the information 
I want, and no unwanted information.



-- 
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: notifications-unsubscr...@geode.apache.org

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

Reply via email to