Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-4520

Fix swatch-contracts pagination issue with capacity endpoints

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • swatch-contracts
    • None
    • 1
    • False
    • Hide

      None

      Show
      None
    • False
    • subs-swatch-lightning

      During the implementation of component tests for SWATCH-4296, a pagination bug was identified in the Page.hasNext() method. When checking for available pages, the method incorrectly compares the next offset against the current page content size instead of the total result count. This causes the "next" pagination link to be null even when additional pages exist.

      Current implementation: The method currently returns: pageable.getNextOffset() < content.size()

      When InMemoryPager creates a Page object with a paginated subset (e.g., 10 items from 100 total), the logic compares nextOffset (10) < content.size() (10), which returns false.

      Suggested fix: The logic should be updated to compare against the total result count: pageable.getNextOffset() < pageable.size

      Production Impact

      This bug has not affected clients in production because:

      1. Capacity endpoints do not use pagination parameters.

      Acceptance Criteria

      • Fix implemented in Page.hasNext() to check total size instead of page content size.
      • @Disabled annotations removed from TC001 and TC002 in CapacityReportPaginationComponentTest.
      • All three pagination component tests passing (TC001, TC002, TC003).
      • Existing subscription and capacity endpoint functionality verified with no regressions.

              Unassigned Unassigned
              rh-ee-gmantzou Georgios Mantzounis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: