Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213932

[TESTBUG] assertEquals is invoked with the arguments in the wrong order

    XMLWordPrintable

Details

    Backports

      Description

        Ref: ./java/lang/invoke/lookup/SpecialStatic.java

        assertEquals(result, 1);

        It passes (actual, expected) but junit.Assert.assertEquals takes (expected, actual). This is the opposite of what testng.Assert.assertEquals does.

        If the assertion fails the error message is very confusing:

        java.lang.AssertionError: expected:<3> but was:<1>

        instead of

        java.lang.AssertionError: expected:<1> but was:<3>

        The mix of junit and testng throughout the tests means it is very easy to get this wrong and there are likely other occurrences.

        Attachments

          Issue Links

            Activity

              People

                mchung Mandy Chung
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: