You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by GitBox <gi...@apache.org> on 2022/10/26 07:46:24 UTC

[GitHub] [wicket] timtebeek commented on pull request #546: WICKET-7011 Swap assertion arguments to conform to expected vs actual

timtebeek commented on PR #546:
URL: https://github.com/apache/wicket/pull/546#issuecomment-1291631783

   Might have found an issue in `AppendingStringBuffer`; [the equals method](https://github.com/apache/wicket/blob/master/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java#L1659) does not return the same when comparing String with AppendingStringBuffer, as when you compare AppendingStringBuffer with String.
   
   When you change:
   ```diff
   diff --git a/wicket-util/src/test/java/org/apache/wicket/util/string/AppendingStringBufferTest.java b/wicket-util/src/test/java/org/apache/wicket/util/string/AppendingStringBufferTest.java
   index 7eedb46fed..e1ac4b0883 100644
   --- a/wicket-util/src/test/java/org/apache/wicket/util/string/AppendingStringBufferTest.java
   +++ b/wicket-util/src/test/java/org/apache/wicket/util/string/AppendingStringBufferTest.java
   @@ -67,7 +67,7 @@ public class AppendingStringBufferTest
                   AppendingStringBuffer asb = new AppendingStringBuffer("123456789");
                   StringBuilder sb = new StringBuilder("123456789");
                   assertEquals(asb, sb);
   -               assertEquals(asb, "123456789");
   +               assertEquals("123456789", asb);
    
                   sb = new StringBuilder("01234567890");
                   assertNotEquals(asb, sb);
   ```
   
   You get:
   ```
   [ERROR] Failures: 
   [ERROR]   AppendingStringBufferTest.equalsToCharSequence:70
     expected: java.lang.String@52cb4f50<123456789>
     but was: org.apache.wicket.util.string.AppendingStringBuffer@25a5c7db<123456789>
   ```
   Might be worth creating a separate issue for.


-- 
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: commits-unsubscribe@wicket.apache.org

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