### Question:
MessageTracker { public void trackReceived(long timestamp) { if (enabled) { receivedBuffer.write(new BufferedMessage(timestamp)); } } MessageTracker(int buffer_size); void trackSent(long timestamp); void trackSent(int packetType); void trackReceived(long timestamp); void trackReceived(int packetType); final BufferedMessage peekSent(); final BufferedMessage peekReceived(); final long peekSentTimestamp(); final long peekReceivedTimestamp(); void dumpToLog(String serverAddress); static final String MESSAGE_TRACKER_BUFFER_SIZE; static final String MESSAGE_TRACKER_ENABLED; static final int BUFFERED_MESSAGE_SIZE; }### Answer:
@Test public void testTrackReceived() throws InterruptedException { long timestamp1 = System.currentTimeMillis(); MessageTracker messageTracker = new MessageTracker(BUFFERED_MESSAGE_SIZE); messageTracker.trackReceived(timestamp1); assertEquals(messageTracker.peekReceivedTimestamp(), timestamp1); Thread.sleep(2); long timestamp2 = System.currentTimeMillis(); messageTracker.trackReceived(timestamp2); assertEquals(messageTracker.peekReceivedTimestamp(), timestamp1); }