Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-10182

TestRamUsageEstimator asserts trivial equality

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.0
    • None
    • None
    • New

    Description

      TestRamUsageEstimator.testStaticOverloads has serveral lines like:

      assertEquals(sizeOf(array), sizeOf((Object) array));
      

      Both calls to sizeOf() fall back on RamUsageTester.sizeOf, making the 2 calls identical. Instead, we would want one of the calls to go to RamUsageEstimator.sizeOf.

       

      This issue came up while working on LUCENE-10129. A possible solution, as per uschindler's suggestion, would be to remove the static import

      import static org.apache.lucene.util.RamUsageTester.sizeOf;
      

      Instead, we could be explicit on which method we are calling, like:

      assertEquals(RamUsageEstimator.sizeOf(array), RamUsageTester.sizeOf(array));
      

      This could be replicated for other potentially confusing cases in the test class.

      Attachments

        Activity

          People

            uschindler Uwe Schindler
            stefanvodita Stefan Vodita
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m