### Question:
FutureMessageBuffer { @VisibleForTesting long totalMessagesSize() { return buffer.values().stream().map(List::size).reduce(0, Integer::sum).longValue(); } FutureMessageBuffer(
      final long futureMessagesMaxDistance,
      final long futureMessagesLimit,
      final long chainHeight); void addMessage(final long msgChainHeight, final Message rawMsg); List<Message> retrieveMessagesForHeight(final long height);  }### Answer:
@Test public void totalMessagesSizeUpdatedWhenMessagesAdded() { futureMsgBuffer = new FutureMessageBuffer(5, 10, 0); addMessages(1, 2); assertThat(futureMsgBuffer.totalMessagesSize()).isEqualTo(2); addMessages(2, 3); assertThat(futureMsgBuffer.totalMessagesSize()).isEqualTo(5); addMessages(1, 3); assertThat(futureMsgBuffer.totalMessagesSize()).isEqualTo(8); }