public static int read(final AtomicBuffer buffer, final ErrorConsumer consumer)
    {
        return read(buffer, consumer, 0);
    }
@Test
    void shouldNotExceedEndOfBufferWhenReadinErrorMessage()
    {
        final UnsafeBuffer buffer = new UnsafeBuffer(new byte[64]);
        buffer.setMemory(0, buffer.capacity(), (byte)'?');
        final long lastTimestamp = 347923749327L;
        final long firstTimestamp = -8530458948593L;
        final int count = 999;
        buffer.putInt(LENGTH_OFFSET, Integer.MAX_VALUE);
        buffer.putLong(LAST_OBSERVATION_TIMESTAMP_OFFSET, lastTimestamp);
        buffer.putLong(FIRST_OBSERVATION_TIMESTAMP_OFFSET, firstTimestamp);
        buffer.putInt(OBSERVATION_COUNT_OFFSET, count);
        buffer.putStringWithoutLengthAscii(ENCODED_ERROR_OFFSET, "test");
        final String expectedErrorString =
            buffer.getStringWithoutLengthAscii(ENCODED_ERROR_OFFSET, buffer.capacity() - ENCODED_ERROR_OFFSET);
        final ErrorConsumer errorConsumer = mock(ErrorConsumer.class);

        assertEquals(1, ErrorLogReader.read(buffer, errorConsumer, 0));

        verify(errorConsumer).accept(count, firstTimestamp, lastTimestamp, expectedErrorString);
    }