### Question:
RocksDBIncrementalCheckpointUtils { @Nullable public static KeyedStateHandle chooseTheBestStateHandleForInitial( @Nonnull Collection<KeyedStateHandle> restoreStateHandles, @Nonnull KeyGroupRange targetKeyGroupRange) { KeyedStateHandle bestStateHandle = null; double bestScore = 0; for (KeyedStateHandle rawStateHandle : restoreStateHandles) { double handleScore = STATE_HANDLE_EVALUATOR.apply(rawStateHandle, targetKeyGroupRange); if (handleScore > bestScore) { bestStateHandle = rawStateHandle; bestScore = handleScore; } } return bestStateHandle; }  static void clipDBWithKeyGroupRange(
		@Nonnull RocksDB db,
		@Nonnull List<ColumnFamilyHandle> columnFamilyHandles,
		@Nonnull KeyGroupRange targetKeyGroupRange,
		@Nonnull KeyGroupRange currentKeyGroupRange,
		@Nonnegative int keyGroupPrefixBytes); static boolean beforeThePrefixBytes(@Nonnull byte[] bytes, @Nonnull byte[] prefixBytes); @Nullable static KeyedStateHandle chooseTheBestStateHandleForInitial(
		@Nonnull Collection<KeyedStateHandle> restoreStateHandles,
		@Nonnull KeyGroupRange targetKeyGroupRange);  }### Answer:
@Test public void testChooseTheBestStateHandleForInitial() { List<KeyedStateHandle> keyedStateHandles = new ArrayList<>(3); KeyedStateHandle keyedStateHandle1 = mock(KeyedStateHandle.class); when(keyedStateHandle1.getKeyGroupRange()).thenReturn(new KeyGroupRange(0, 3)); keyedStateHandles.add(keyedStateHandle1); KeyedStateHandle keyedStateHandle2 = mock(KeyedStateHandle.class); when(keyedStateHandle2.getKeyGroupRange()).thenReturn(new KeyGroupRange(4, 7)); keyedStateHandles.add(keyedStateHandle2); KeyedStateHandle keyedStateHandle3 = mock(KeyedStateHandle.class); when(keyedStateHandle3.getKeyGroupRange()).thenReturn(new KeyGroupRange(8, 12)); keyedStateHandles.add(keyedStateHandle3); Assert.assertNull(RocksDBIncrementalCheckpointUtils.chooseTheBestStateHandleForInitial(keyedStateHandles, new KeyGroupRange(3, 5))); Assert.assertEquals(keyedStateHandle2, RocksDBIncrementalCheckpointUtils.chooseTheBestStateHandleForInitial(keyedStateHandles, new KeyGroupRange(3, 6))); Assert.assertEquals(keyedStateHandle3, RocksDBIncrementalCheckpointUtils.chooseTheBestStateHandleForInitial(keyedStateHandles, new KeyGroupRange(5, 12))); Assert.assertEquals(keyedStateHandle3, RocksDBIncrementalCheckpointUtils.chooseTheBestStateHandleForInitial(keyedStateHandles, new KeyGroupRange(3, 12))); }