FileMerger extends FileStitcher<OutputFileMetadata> { public void setOverwriteOnConflict(boolean overwriteOnConflict) { this.overwriteOnConflict = overwriteOnConflict; }  @Override void beginWindow(long windowId); boolean isOverwriteOnConflict(); void setOverwriteOnConflict(boolean overwriteOnConflict);  }
@Test public void testOverwriteFlag() throws IOException, InterruptedException { FileUtils.write(new File(testFM.outputDir, testFM.outputFileName), ""); long modTime = testFM.underTest.outputFS.getFileStatus(new Path(testFM.outputDir, testFM.outputFileName)) .getModificationTime(); when(testFM.fileMetaDataMock.getNumberOfBlocks()).thenReturn(0); when(testFM.fileMetaDataMock.isDirectory()).thenReturn(false); when(testFM.fileMetaDataMock.getBlockIds()).thenReturn(new long[] {}); Thread.sleep(1000); testFM.underTest.setOverwriteOnConflict(true); testFM.underTest.processCommittedData(testFM.fileMetaDataMock); FileStatus fileStatus = testFM.underTest.outputFS.getFileStatus(new Path(testFM.outputDir, testFM.outputFileName)); Assert.assertTrue(fileStatus.getModificationTime() > modTime); }