@Test
public void testAdvanceAfterTargetScn()
{

  BootstrapCheckpointHandler handler = new BootstrapCheckpointHandler(ONE_SOURCE);
  Checkpoint cp1 = handler.createInitialBootstrapCheckpoint(null, 100L);
  assertStartBootstrapCheckpoint(handler, cp1, ONE_SOURCE[0], 100L);
  cp1.setBootstrapStartScn(200L);
  //now finalize the snapshot phase
  handler.finalizeSnapshotPhase(cp1);
  assertSnapshotCompleteCheckpoint(handler, cp1, 0, ONE_SOURCE[0]);
  Assert.assertTrue(cp1.isSnapShotSourceCompleted());
  //now advance to next phase -- catchup
  handler.advanceAfterSnapshotPhase(cp1);
  assertAfterSnapshotCheckpoint(cp1, 1, Checkpoint.NO_SOURCE_NAME);
  Assert.assertTrue(cp1.isSnapShotSourceCompleted());
  Assert.assertTrue(!handler.needsMoreSnapshot(cp1));
  //try to set an invalid targetSCN (< startSCN)
  try
  {
    cp1.setBootstrapTargetScn(100L);
    Assert.fail("InvalidCheckpointException expected");
  }
  catch (InvalidCheckpointException e)
  {
    //OK
  }
  //try to setup -1 as targetScn
  try
  {
    cp1.setBootstrapTargetScn(Checkpoint.UNSET_BOOTSTRAP_TARGET_SCN);
    handler.advanceAfterTargetScn(cp1);
    Assert.fail("InvalidCheckpointException expected");
  }
  catch (InvalidCheckpointException e)
  {
    //OK
  }
  cp1.setBootstrapTargetScn(200L);
  handler.advanceAfterTargetScn(cp1);
  Assert.assertEquals(DbusClientMode.BOOTSTRAP_CATCHUP, cp1.getConsumptionMode());
  Assert.assertEquals(cp1.getWindowOffset().longValue(), 0L);
  Assert.assertEquals(cp1.getWindowScn(), cp1.getBootstrapStartScn().longValue());
}