### Question:
MessagesServlet extends HttpServlet { static List<String> getMessages() { return new ArrayList<>(messages); }    }### Answer:
@Test public void afterMaximumExchangesAdded_retrieveAllExchanges() { IntStream.rangeClosed(1, MAX_EXCHANGES).forEach(this::addTestExchange); assertThat(MessagesServlet.getMessages(), contains(getExchangeMatchers(1, MAX_EXCHANGES))); }
@Test public void afterMoreThanMaximumExchangesAdded_retrieveLastMExchanges() { IntStream.rangeClosed(1, MAX_EXCHANGES+EXCESS_EXCHANGES).forEach(this::addTestExchange); assertThat(MessagesServlet.getMessages(), contains(getExchangeMatchers(EXCESS_EXCHANGES+1, MAX_EXCHANGES+EXCESS_EXCHANGES))); }