@Test
public void testProcessStats() throws Exception
{

  underTest.setPartitionCount(4);
  underTest.setPreferredMaxPendingFilesPerOperator(10);
  for (int i = 0; i < 21; i++) {
    underTest.pendingFiles.add("file-" + i);
  }
  mockOperatorStats.counters = fileCountersMock;
  when(mockPartition.getStats()).thenReturn(mockBatchStats);
  when(mockBatchStats.getLastWindowedStats()).thenReturn(Collections.singletonList(mockOperatorStats));
  when(fileCountersMock.getCounter(any(FileCounters.class))).thenReturn(fileCounterMock);
  when(fileCounterMock.getValue()).thenReturn(20L);
  Response response = underTest.processStats(mockBatchStats);
  Assert.assertTrue(response.repartitionRequired);
}