@Test
public void shouldNotCleanupUncompressedFileIfNotRequired() {

  File fileToUpload = mock(File.class);
  String fileName = "hdfs_namenode.log.123343493473948";
  expect(fileToUpload.getName()).andReturn(fileName);
  final File compressedFile = mock(File.class);
  Map<String, Object> configs = setupS3Configs();
  S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
  expect(compressedFile.delete()).andReturn(true);
  replay(fileToUpload, compressedFile);
  S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, false, LOG_TYPE) {
    @Override
    protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
      return compressedFile;
    }
    protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
    }
  };
  s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
  verify(fileToUpload);
  verify(compressedFile);
}