    @Test
    public void shouldPublishFilledBatchOnSubmissionOfNewEvent() throws JsonProcessingException {

        EventLog eventLogEntry1 = eventLogEntry(1, "type1");
        EventLog eventLogEntry2 = eventLogEntry(2, "type1");
        EventLog eventLogEntry3 = eventLogEntry(3, "type1");
        NakadiEvent nakadiEvent1 = nakadiEvent("1");
        NakadiEvent nakadiEvent2 = nakadiEvent("2");
        NakadiEvent nakadiEvent3 = nakadiEvent("3");

        when(objectMapper.writeValueAsBytes(any())).thenReturn(new byte[15000000]);

        // 15 MB batch size
        eventBatcher.pushEvent(eventLogEntry1, nakadiEvent1);
        // 30 MB batch size
        eventBatcher.pushEvent(eventLogEntry2, nakadiEvent2);
        // would be 45MB batch size, wich is more than 80% of 50MB,therefore triggers sumission of the previous two
        eventBatcher.pushEvent(eventLogEntry3, nakadiEvent3);

        verify(publisher)
                .accept(eq(asList(
                    new BatchItem(eventLogEntry1, nakadiEvent1),
                    new BatchItem(eventLogEntry2, nakadiEvent2)
                )));
    }