public static ChangeStreamContinuationToken getTokenWithCorrectPartition(
      ByteStringRange parentPartition, ChangeStreamContinuationToken token)
      throws IllegalArgumentException {
    return ChangeStreamContinuationToken.create(
        getIntersectingPartition(parentPartition, token.getPartition()), token.getToken());
  }
@Test
  public void testGetTokenWithCorrectPartition() {
    ChangeStreamContinuationToken token1 =
        ChangeStreamContinuationToken.create(ByteStringRange.create("A", "D"), "token1");
    ChangeStreamContinuationToken token2 =
        ChangeStreamContinuationToken.create(ByteStringRange.create("B", "E"), "token2");
    ByteStringRange parentPartition1 = ByteStringRange.create("A", "F");
    ByteStringRange parentPartition2 = ByteStringRange.create("C", "F");
    ByteStringRange parentPartition3 = ByteStringRange.create("C", "D");
    ByteStringRange parentPartition4 = ByteStringRange.create("A", "B");

    assertEquals(
        ByteStringRange.create("A", "D"),
        getTokenWithCorrectPartition(parentPartition1, token1).getPartition());
    assertEquals(
        ByteStringRange.create("B", "E"),
        getTokenWithCorrectPartition(parentPartition1, token2).getPartition());
    assertEquals(
        ByteStringRange.create("C", "D"),
        getTokenWithCorrectPartition(parentPartition2, token1).getPartition());
    assertEquals(
        ByteStringRange.create("C", "E"),
        getTokenWithCorrectPartition(parentPartition2, token2).getPartition());
    assertEquals(
        ByteStringRange.create("C", "D"),
        getTokenWithCorrectPartition(parentPartition3, token1).getPartition());
    assertEquals(
        ByteStringRange.create("C", "D"),
        getTokenWithCorrectPartition(parentPartition3, token2).getPartition());
    assertEquals(
        ByteStringRange.create("A", "B"),
        getTokenWithCorrectPartition(parentPartition4, token1).getPartition());
    assertThrows(
        IllegalArgumentException.class,
        () -> getTokenWithCorrectPartition(parentPartition4, token2));
  }