GenericTransportBuffer implements TransportBuffer { @Override public void clear() { this.batchSize = 0; this.baos.reset(); } GenericTransportBuffer(long maxBatchSize, boolean useCompression,
      TransportSerializer serializer); @Override boolean add(InternalEvent ievent); @Override ByteArrayOutputStream getInternalBuffer(); @Override boolean isEmpty(); @Override void close(); @Override void clear();  }
@Test public void testClear() throws IOException { GenericTransportSerializer serializer = mock(GenericTransportSerializer.class); doReturn("foo".getBytes()).when(serializer).serialize(any(InternalEvent.class)); GenericTransportBuffer buffer = new GenericTransportBuffer(1, 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()); }