@Test
  public void testRotateFailed() throws Exception {
    when(indices.getIndexStats("name")).thenReturn(null);
    when(deflector.getNewestTargetName()).thenReturn("name");
    when(clusterConfigService.get(SizeBasedRotationStrategyConfig.class))
        .thenReturn(SizeBasedRotationStrategyConfig.create(100));

    final SizeBasedRotationStrategy strategy =
        new SizeBasedRotationStrategy(
            indices, deflector, clusterConfigService, nodeId, auditEventSender);

    strategy.rotate();
    verify(deflector, never()).cycle();
    reset(deflector);
  }
  @Test
  public void testDontRotate() throws Exception {
    final CommonStats commonStats = new CommonStats();
    commonStats.store = new StoreStats(1000, 0);
    final IndexStatistics stats =
        IndexStatistics.create(
            "name", commonStats, commonStats, Collections.<ShardRouting>emptyList());

    when(indices.getIndexStats("name")).thenReturn(stats);
    when(deflector.getNewestTargetName()).thenReturn("name");
    when(clusterConfigService.get(SizeBasedRotationStrategyConfig.class))
        .thenReturn(SizeBasedRotationStrategyConfig.create(100000L));

    final SizeBasedRotationStrategy strategy =
        new SizeBasedRotationStrategy(
            indices, deflector, clusterConfigService, nodeId, auditEventSender);

    strategy.rotate();
    verify(deflector, never()).cycle();
    reset(deflector);
  }