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

Fix misleading SUBSCRIBED/UNSUBSCRIBED status references in swatch-contracts test plan and component tests

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • Next - API
    • None
    • swatch-contracts
    • None
    • Swatch Lightning Sprint 10

      Our contract termination test plan and component tests incorrectly claim that the backend uses the status field (SUBSCRIBED/UNSUBSCRIBED) from partner entitlement messages to determine whether a contract is active or terminated. After reviewing the backend code, this is wrong – swatch-contracts completely ignores the status field and relies exclusively on startDate and endDate from the partner entitlement message to determine contract lifecycle state.

      The status field exists in the PartnerEntitlementV1 API schema, but ContractService, ContractEntityMapper, and all related processing logic never call getStatus(). There is no status column in ContractEntity or SubscriptionEntity. Active/terminated state is purely date-driven: a contract is active when startDate <= now and endDate IS NULL OR endDate >= now.

      This means that 5 test plan entries in the "Contract Termination" section of swatch-contracts/TEST_PLAN.md (TC001 through TC005) have misleading descriptions that frame the tests around SUBSCRIBED/UNSUBSCRIBED status validation, when in reality the behavior being tested is driven by the contract dates. The corresponding component tests in ContractsTerminationComponentTest.java pass by coincidence, but their names, comments, and setup logic (using forContractWithStatus()) incorrectly suggest that the status field is the variable under test.

      Acceptance Criteria

      • Update TEST_PLAN.md – Contract Termination section (TC001 to TC005): Rewrite descriptions to remove references to "status"
      • Update/Refactor ContractsTerminationComponentTest.java (TC001 to TC005) around the SUBSCRIBED and UNSUBSCRIBED constants
      • PartnerApiStubs.java: Evaluate whether forContractWithStatus() should be removed or simplified

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: