@Test public void shouldReadTwoDistinctObservations() { final ErrorConsumer consumer = mock(ErrorConsumer.class); final long timestampOne = 7; final long timestampTwo = 10; final RuntimeException errorOne = new RuntimeException("Test Error One"); final IllegalStateException errorTwo = new IllegalStateException("Test Error Two"); when(clock.time()).thenReturn(timestampOne).thenReturn(timestampTwo); log.record(errorOne); log.record(errorTwo); assertThat(ErrorLogReader.read(buffer, consumer), is(2)); final InOrder inOrder = inOrder(consumer); inOrder.verify(consumer).accept(eq(1), eq(timestampOne), eq(timestampOne), any(String.class)); inOrder.verify(consumer).accept(eq(1), eq(timestampTwo), eq(timestampTwo), any(String.class)); }
public static int read(final AtomicBuffer buffer, final ErrorConsumer consumer) { return read(buffer, consumer, 0); }
ErrorLogReader { public static int read(final AtomicBuffer buffer, final ErrorConsumer consumer) { return read(buffer, consumer, 0); } }
ErrorLogReader { public static int read(final AtomicBuffer buffer, final ErrorConsumer consumer) { return read(buffer, consumer, 0); }  }
ErrorLogReader { public static int read(final AtomicBuffer buffer, final ErrorConsumer consumer) { return read(buffer, consumer, 0); }  static boolean hasErrors(final AtomicBuffer buffer); static int read(final AtomicBuffer buffer, final ErrorConsumer consumer); static int read(final AtomicBuffer buffer, final ErrorConsumer consumer, final long sinceTimestamp); }
ErrorLogReader { public static int read(final AtomicBuffer buffer, final ErrorConsumer consumer) { return read(buffer, consumer, 0); }  static boolean hasErrors(final AtomicBuffer buffer); static int read(final AtomicBuffer buffer, final ErrorConsumer consumer); static int read(final AtomicBuffer buffer, final ErrorConsumer consumer, final long sinceTimestamp);  }