You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/02/23 23:59:32 UTC

[GitHub] [geode] demery-pivotal commented on a change in pull request #6013: GEODE-8768_1: locator discovery improvement

demery-pivotal commented on a change in pull request #6013:
URL: https://github.com/apache/geode/pull/6013#discussion_r581479153



##########
File path: geode-core/src/test/java/org/apache/geode/internal/admin/remote/DistributionLocatorIdJUnitTest.java
##########
@@ -46,4 +48,25 @@ public void testEquals() throws UnknownHostException {
 
   }
 
+  @Test
+  public void testEquals_and_DetailCompare() throws UnknownHostException {
+    DistributionLocatorId dLI1 = new DistributionLocatorId(40404, "127.0.0.1", null);
+    DistributionLocatorId dLI2 =
+        new DistributionLocatorId(40404, "127.0.0.1", "127.0.1.0", "member2");;
+    DistributionLocatorId dLI3 = new DistributionLocatorId(40404, "127.0.0.1", null, "member3");
+    DistributionLocatorId dLI4 = new DistributionLocatorId(dLI3.marshal());
+
+    assertTrue(dLI1.equals(dLI2));
+    assertTrue(dLI1.equals(dLI3));
+    assertTrue(dLI1.equals(dLI4));
+
+    assertTrue(dLI1.getMemberName().equals(DistributionConfig.DEFAULT_NAME));
+    assertTrue(dLI2.getMemberName().equals("member2"));
+    assertTrue(dLI3.getMemberName().equals("member3"));
+    assertTrue(dLI4.getMemberName().equals(DistributionConfig.DEFAULT_NAME));
+
+    assertTrue(dLI1.detailCompare(dLI3));
+    assertFalse(dLI2.detailCompare(dLI4));

Review comment:
       You can improve the failure message by adding an `as()` that describes the meaning of the boolean. Something like:
   ```
   assertThat(dLI2.detailCompare(dLI4))
       .as("Distribution locator IDs 2 and 4 are equal")
       .isFalse();
   ```




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

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