@Test public void testBufferFinishesSomewhen() throws IOException, InterruptedException { final AtomicInteger counter = new AtomicInteger(0); BaseFileBuffer buffer = new BaseFileBuffer(null) { @Override protected void processBuffer(IFileBufferHolder buffer) { counter.set(buffer.getFileBuffer().size()); } }; File directory = new File(FileUtils.getTempDirectory(), UUID.randomUUID().toString()); buffer.addFileToBuffer(directory); buffer.addFileToBuffer(createFileRandomContent(directory)); Thread.sleep((long) (IFileBuffer.BUFFER_WAIT_TIME_MS * 1.5)); Assert.assertEquals(2, counter.get()); }
@Override public final synchronized void addFileToBuffer(File file) { if (currentBuffer == null) { currentBuffer = new FileBufferHolder(); startBuffering(currentBuffer); } currentBuffer.addFile(file); }
BaseFileBuffer implements IFileBuffer { @Override public final synchronized void addFileToBuffer(File file) { if (currentBuffer == null) { currentBuffer = new FileBufferHolder(); startBuffering(currentBuffer); } currentBuffer.addFile(file); } }
BaseFileBuffer implements IFileBuffer { @Override public final synchronized void addFileToBuffer(File file) { if (currentBuffer == null) { currentBuffer = new FileBufferHolder(); startBuffering(currentBuffer); } currentBuffer.addFile(file); } protected  BaseFileBuffer(IFileManager fileManager); }
BaseFileBuffer implements IFileBuffer { @Override public final synchronized void addFileToBuffer(File file) { if (currentBuffer == null) { currentBuffer = new FileBufferHolder(); startBuffering(currentBuffer); } currentBuffer.addFile(file); } protected  BaseFileBuffer(IFileManager fileManager); @Override final synchronized void addFileToBuffer(File file); }
BaseFileBuffer implements IFileBuffer { @Override public final synchronized void addFileToBuffer(File file) { if (currentBuffer == null) { currentBuffer = new FileBufferHolder(); startBuffering(currentBuffer); } currentBuffer.addFile(file); } protected  BaseFileBuffer(IFileManager fileManager); @Override final synchronized void addFileToBuffer(File file);  }