mhansonp commented on code in PR #7608:
URL: https://github.com/apache/geode/pull/7608#discussion_r858076385


##########
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:
   The code below will produce one and only one failure per line and clicking 
the stack trace line will take you to the one failure
    
   
   _assertThat(example).hasSize(1);_
   
   entry count doesn't match ....
   
   ```
   java.lang.AssertionError: 
   Expected size: 1 but was: 2 in:
   {"0"="ZERO", "1"="ONE"}
   
   at 
org.apache.geode.cache.client.ClientServerRegisterInterestsDUnitTest.testClientRegisterInterests(ClientServerRegisterInterestsDUnitTest.java:211)
   ```
   
   
   _assertThat(example).containsKey("1");_
   
   key doesn't match
   
   ```
   org.opentest4j.AssertionFailedError: 
   expected: "ONE"
    but was: null
   Expected :"ONE"
   Actual   :null
   
   at 
org.apache.geode.cache.client.ClientServerRegisterInterestsDUnitTest.testClientRegisterInterests(ClientServerRegisterInterestsDUnitTest.java:212)
   ```
   
   
   _assertThat(example.get("1")).isEqualTo("ONE");_
   
   value doesn't match 
   
   ```
   org.opentest4j.AssertionFailedError: 
   expected: "ONE"
    but was: "ZERO"
   Expected :"ONE"
   Actual   :"ZERO"
   at 
org.apache.geode.cache.client.ClientServerRegisterInterestsDUnitTest.testClientRegisterInterests(ClientServerRegisterInterestsDUnitTest.java:213)
   ```
   
   Any of the three failures will lead you to the one line below and you will 
have to break it apart  (if it was more complex) to test each condition.
   
   _assertThat(example).containsOnly(entry("1", "ONE"));_
   
   
   entry doesn't match ....
   
   ```
   java.lang.AssertionError: 
   Expecting map:
     {"2"="ONE"}
   to contain only:
     ["1"="ONE"]
   map entries not found:
     ["1"="ONE"]
   and map entries not expected:
     ["2"="ONE"]
   
        at 
org.apache.geode.cache.client.ClientServerRegisterInterestsDUnitTest.testClientRegisterInterests(ClientServerRegisterInterestsDUnitTest.java:213)
   
   ```
   count doesn't match ....
   
   ```
   java.lang.AssertionError: 
   Expecting map:
     {"0"="ZERO", "1"="ONE"}
   to contain only:
     ["1"="ONE"]
   but the following map entries were unexpected:
     ["0"="ZERO"]
   
        at 
org.apache.geode.cache.client.ClientServerRegisterInterestsDUnitTest.testClientRegisterInterests(ClientServerRegisterInterestsDUnitTest.java:213)
   ```
   
   Key not present...
   ```
   java.lang.AssertionError: 
   Expecting map:
     {"0"="ZERO"}
   to contain only:
     ["1"="ONE"]
   map entries not found:
     ["1"="ONE"]
   and map entries not expected:
     ["0"="ZERO"]
   
        at 
org.apache.geode.cache.client.ClientServerRegisterInterestsDUnitTest.testClientRegisterInterests(ClientServerRegisterInterestsDUnitTest.java:213)
   ```
   
   



-- 
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