Class DatasetsWebServiceSubSetSamplesCursorTest

java.lang.Object
ubic.gemma.rest.DatasetsWebServiceSubSetSamplesCursorTest

@ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class) public class DatasetsWebServiceSubSetSamplesCursorTest extends Object
Unit tests for the cursor-pagination branch added to DatasetsWebService#getDatasetSubSetSamples(DatasetArg, Long, CursorArg, LimitArg) as step 1u of CURSOR_PAGINATION_STEP1_PLAN.md. Pure Mockito — the goal is to verify the WebService routes cursor vs legacy modes to the right helper and emits the right response wrapper, not to retest the DAO (covered by the broader DAO-cursor suite).

Mirrors DatasetsWebServiceSamplesCursorTest (step 1k): the legacy mode is NOT offset-paginated for this endpoint — it returns an unpaginated ResponseDataObject<List<BioAssayValueObject>>. The cursor branch is therefore strictly additive (an opt-in via ?cursor=). Unlike step 1k, this endpoint has no quantitationType parameter, so there is no mutual-exclusion-with-cursor case to test.

Author:
phase3
  • Constructor Details

    • DatasetsWebServiceSubSetSamplesCursorTest

      public DatasetsWebServiceSubSetSamplesCursorTest()
  • Method Details

    • setUp

      @BeforeEach public void setUp()
    • legacyModeWithoutCursorReturnsUnpaginatedResponseDataObject

      @Test public void legacyModeWithoutCursorReturnsUnpaginatedResponseDataObject()
    • cursorModeRoutesToCursorHelperAndReturnsCursorPaginatedResponse

      @Test public void cursorModeRoutesToCursorHelperAndReturnsCursorPaginatedResponse()
    • cursorModeDecodesCursorAndForwardsToArgService

      @Test public void cursorModeDecodesCursorAndForwardsToArgService()
    • limitWithoutCursorIsRejectedAs400

      @Test public void limitWithoutCursorIsRejectedAs400()
      Same rule as the parent /datasets/{id}/samples listing: this route is unpaginated without a cursor and has no field in which to declare a truncation, so a limit it cannot honour is refused rather than dropped. Treated identically because the two routes have the same shape — a client that learned the parent's behaviour must not find the sibling silently different.
    • cursorModeWithoutLimitUsesTheDefaultPageSize

      @Test public void cursorModeWithoutLimitUsesTheDefaultPageSize()
      Cursor mode still has a page size when the caller sends none — dropping @DefaultValue("20") from the parameter moved that default into the method, and it has to still be there.
    • cursorModeWithEmptyPageRoundTripsThroughWrapper

      @Test public void cursorModeWithEmptyPageRoundTripsThroughWrapper()