use of com.nextdoor.bender.ipc.generic.GenericTransportSerializer in project bender by Nextdoor.
the class GenericTransportBufferTest method testEmptyBuffer.
@Test
public void testEmptyBuffer() throws IOException {
GenericTransportSerializer serializer = mock(GenericTransportSerializer.class);
doReturn("foo".getBytes()).when(serializer).serialize(any(InternalEvent.class));
GenericTransportBuffer buffer = new GenericTransportBuffer(1, false, serializer);
assertEquals(true, buffer.isEmpty());
}
use of com.nextdoor.bender.ipc.generic.GenericTransportSerializer in project bender by Nextdoor.
the class GenericTransportBufferTest method testAdd.
@Test
public void testAdd() 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);
ByteArrayOutputStream baos = buffer.getInternalBuffer();
baos.close();
String actual = new String(baos.toByteArray());
assertEquals("foo", actual);
assertEquals(false, buffer.isEmpty());
}
Aggregations