S3TransportBuffer implements TransportBuffer { @Override public void clear() { this.baos.reset(); this.cos.resetByteCount(); } S3TransportBuffer(long maxBytes, boolean useCompression, S3TransportSerializer serializer); @Override boolean add(InternalEvent ievent); @Override ByteArrayOutputStream getInternalBuffer(); @Override boolean isEmpty(); @Override void close(); @Override void clear(); boolean isCompressed();  }
@Test public void testClear() throws IOException, TransportException { S3TransportSerializer serializer = mock(S3TransportSerializer.class); doReturn("foo".getBytes()).when(serializer).serialize(any(InternalEvent.class)); S3TransportBuffer buffer = new S3TransportBuffer(5, false, serializer); InternalEvent mockEvent = mock(InternalEvent.class); buffer.add(mockEvent); buffer.close(); String actual = new String(buffer.getInternalBuffer().toByteArray()); assertEquals("foo", actual); buffer.clear(); assertEquals(true, buffer.isEmpty()); }