SourceHandler { protected void rotateOutputFile() throws IOException { LOG.debug("Rotating output file..."); long start = System.currentTimeMillis(); synchronized (this.writeLock) { closeOutputFile(); cleanupCallback(); LOG.debug("Performing {} file rotation actions.", this.rotationActions.size()); for (RotationAction action : this.rotationActions) { action.execute(this.fs, this.currentFile); } } long time = System.currentTimeMillis() - start; LOG.info("File rotation took {} ms", time); } SourceHandler(List<RotationAction> rotationActions
                      , FileRotationPolicy rotationPolicy
                      , SyncPolicy syncPolicy
                      , FileNameFormat fileNameFormat
                      , SourceHandlerCallback cleanupCallback); void close(); @Override String toString();  }
@Test public void testRotateOutputFile() throws IOException { SourceHandler handler = new SourceHandler( rotActions, new FileSizeRotationPolicy(10000, Units.MB), new CountSyncPolicy(1), testFormat, callback ); handler.rotateOutputFile(); verify(rotAction1).execute(any(), any()); verify(rotAction2).execute(any(), any()); verify(callback).removeKey(); }