@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());
}