@Test
  public void testDifferentStateModelDefs() {
    AmbryStateModelFactory factory = new AmbryStateModelFactory(config, new PartitionStateChangeListener() {
      @Override
      public void onPartitionBecomeBootstrapFromOffline(String partitionName) {
        // no op
      }

      @Override
      public void onPartitionBecomeStandbyFromBootstrap(String partitionName) {
        // no op
      }

      @Override
      public void onPartitionBecomeLeaderFromStandby(String partitionName) {
        // no op
      }

      @Override
      public void onPartitionBecomeStandbyFromLeader(String partitionName) {
        //no op
      }

      @Override
      public void onPartitionBecomeInactiveFromStandby(String partitionName) {
        // no op
      }

      @Override
      public void onPartitionBecomeOfflineFromInactive(String partitionName) {
        // no op
      }

      @Override
      public void onPartitionBecomeDroppedFromOffline(String partitionName) {
        // no op
      }
    }, mock(HelixClusterManager.class));
    StateModel stateModel;
    switch (config.clustermapStateModelDefinition) {
      case ClusterMapConfig.OLD_STATE_MODEL_DEF:
        stateModel = factory.createNewStateModel("0", "1");
        assertTrue("Unexpected state model def", stateModel instanceof DefaultLeaderStandbyStateModel);
        break;
      case ClusterMapConfig.AMBRY_STATE_MODEL_DEF:
        stateModel = factory.createNewStateModel("0", "1");
        assertTrue("Unexpected state model def", stateModel instanceof AmbryPartitionStateModel);
        break;
      default:
        // state model is already validated in clusterMapConfig, no need to test invalid state model here.
    }
  }
Test for {@link AmbryStateModelFactory} and {@link AmbryPartitionStateModel}
ambry-clustermap/src/test/java/com/github/ambry/clustermap/AmbryStateModelFactoryTest.java