public class SizeBasedRotationStrategyTest {
@Test
public void testRotate() throws IndexNotFoundException {
final Configuration configuration = mock(Configuration.class);
final Indices indices = mock(Indices.class);
final IndexStatistics stats = new IndexStatistics();
final CommonStats commonStats = new CommonStats();
commonStats.store = new StoreStats(1000, 0);
stats.setPrimaries(commonStats);
when(indices.getIndexStats("name")).thenReturn(stats);
when(configuration.getElasticSearchMaxSizePerIndex()).thenReturn(100L);
final SizeBasedRotationStrategy strategy = new SizeBasedRotationStrategy(configuration,
indices);
final RotationStrategy.Result rotate = strategy.shouldRotate("name");