@Test
  public void testRemoteReplicaStandByGroupGenerationCrossColo() {
    ReplicaThread replicaThread = crossColoReplicaThread;
    Map<DataNodeId, List<RemoteReplicaInfo>> dataNodeToReplicaMap = crossColoReplicaThread.getRemoteReplicaInfos();

    replicaThread.setTerminateCurrentContinuousReplicationCycle(false);

    RemoteReplicaGroupPoller poller = replicaThread.new RemoteReplicaGroupPoller();
    List<DataNodeTracker> dataNodeTrackers = poller.getDataNodeTrackers();

    //add replicas for stand by no progress, take one replica from each datanode
    dataNodeTrackers.forEach(dataNodeTracker -> {
      List<ActiveGroupTracker> activeGroupTrackers = dataNodeTracker.getActiveGroupTrackers();
      ReplicaTracker replicaTracker = activeGroupTrackers.get(0).getPreAssignedReplicas().get(0);
      replicaTracker.setReplicaStatus(ReplicaStatus.STANDBY_TIMED_OUT_ON_NO_PROGRESS);
    });

    // after this call, standby replicas will be added to inflight groups
    List<RemoteReplicaGroup> inflightGroups = poller.enqueue();

    // verify if all stand by group ids are created and created correctly
    dataNodeTrackers.forEach(dataNodeTracker -> {
      DataNodeId dataNodeId = dataNodeTracker.getDataNodeId();
      StandByGroupTracker standByGroupTracker = dataNodeTracker.getStandByGroupTracker();

      Assert.assertTrue("standby group id must be in flight", standByGroupTracker.isInFlight());
      Assert.assertFalse("standby group id must be in flight and should not be done ",
          standByGroupTracker.isGroupDone());
      Assert.assertTrue("standby group should be marked no progress",
          standByGroupTracker.getRemoteReplicaGroup().isNonProgressStandbyReplicaGroup());
      Assert.assertEquals("datanode must be correct", dataNodeId,
          standByGroupTracker.getRemoteReplicaGroup().getRemoteDataNode());
    });

    // mark all non standby groups as done
    inflightGroups.forEach((remoteReplicaGroup) -> {
      if (!remoteReplicaGroup.isNonProgressStandbyReplicaGroup()) {
        remoteReplicaGroup.setState(ReplicaThread.ReplicaGroupReplicationState.DONE);
      }
    });

    inflightGroups = poller.enqueue();

    // move time forward till throttling limit
    time.setCurrentMilliseconds(
        time.milliseconds() + replicationConfig.replicationIntraReplicaThreadThrottleSleepDurationMs + 1);

    // after this call new remote replica groups will be created and added to inflight groups
    inflightGroups = poller.enqueue();

    // verify if standby replicas are not added to a group again, i.e all replicas should be unique
    Set<RemoteReplicaInfo> remoteReplicaInfoSet = new HashSet<>();
    inflightGroups.forEach((remoteReplicaGroup) -> {
      remoteReplicaGroup.getRemoteReplicaInfos().forEach(remoteReplicaInfo -> {
        Assert.assertFalse("Remote replicas should not be repeated", remoteReplicaInfoSet.contains(remoteReplicaInfo));
        remoteReplicaInfoSet.add(remoteReplicaInfo);
      });
    });
  }
Tests for whether standby replica group logic is working as expected.
Tested on crossColo replica thread
ambry-replication/src/test/java/com/github/ambry/replication/RemoteReplicaGroupPollerTest.java