aherbert commented on a change in pull request #112: Text 158
URL: https://github.com/apache/commons-text/pull/112#discussion_r264183929
 
 

 ##########
 File path: 
src/test/java/org/apache/commons/text/similarity/JaccardDistanceTest.java
 ##########
 @@ -37,7 +37,7 @@ public static void setUp() {
     @Test
     public void testGettingJaccardDistance() {
         // Expected Jaccard distance = 1.0 - (intersect / union)
-        assertEquals(1.0, classBeingTested.apply("", ""));
+        assertEquals(0.0, classBeingTested.apply("", ""));
 
 Review comment:
   This only works because the unit test passes in the same string on both 
sides, i.e. `"" vs ""`.
   
   Do not use == to measure equality. This measures the same object reference. 
Try this in your test:
   
   ```
   // Change 
   assertEquals(0.0, classBeingTested.apply("", ""));
   // to 
   assertEquals(0.0, classBeingTested.apply("", new StringBuilder()));
   ```
   
   You should fix the code to use `StringUtils.equals(CharSequence, 
CharSequence)` to test for equality.
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to