@Test(expected = IllegalArgumentException.class) public void addNullTest() { container.addMessage(null); }
public void addMessage(final Message m) { synchronized (lock) { if (m == null) { throw new IllegalArgumentException("Cannot add null message"); } if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "cannot add message to the system, " + "exceeded Configuration messageLimit of {0}", messageLimit); throw new IllegalStateException("Cannot add message - message limit exceeded"); } if (expirationTimer == null) { expireMessages(); } AcceptedMessage acceptedMessage = new AcceptedMessage(m); addMessage(acceptedMessage); } }
MessagesContainer { public void addMessage(final Message m) { synchronized (lock) { if (m == null) { throw new IllegalArgumentException("Cannot add null message"); } if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "cannot add message to the system, " + "exceeded Configuration messageLimit of {0}", messageLimit); throw new IllegalStateException("Cannot add message - message limit exceeded"); } if (expirationTimer == null) { expireMessages(); } AcceptedMessage acceptedMessage = new AcceptedMessage(m); addMessage(acceptedMessage); } } }
MessagesContainer { public void addMessage(final Message m) { synchronized (lock) { if (m == null) { throw new IllegalArgumentException("Cannot add null message"); } if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "cannot add message to the system, " + "exceeded Configuration messageLimit of {0}", messageLimit); throw new IllegalStateException("Cannot add message - message limit exceeded"); } if (expirationTimer == null) { expireMessages(); } AcceptedMessage acceptedMessage = new AcceptedMessage(m); addMessage(acceptedMessage); } }  }
MessagesContainer { public void addMessage(final Message m) { synchronized (lock) { if (m == null) { throw new IllegalArgumentException("Cannot add null message"); } if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "cannot add message to the system, " + "exceeded Configuration messageLimit of {0}", messageLimit); throw new IllegalStateException("Cannot add message - message limit exceeded"); } if (expirationTimer == null) { expireMessages(); } AcceptedMessage acceptedMessage = new AcceptedMessage(m); addMessage(acceptedMessage); } }  Set<AcceptedMessage> getAllMessages(); SortedSet<AcceptedMessage> getMessages(); SortedSet<AcceptedMessage> getMessages(final String tag); void addMessage(final Message m); void removeAnyMessage(Set<String> tags); void removeAnyMessage(Set<String> tags, String text); void setMessageLimit(int limit); void startExpirationTimer(); void stopExpirationTimer(); }
MessagesContainer { public void addMessage(final Message m) { synchronized (lock) { if (m == null) { throw new IllegalArgumentException("Cannot add null message"); } if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "cannot add message to the system, " + "exceeded Configuration messageLimit of {0}", messageLimit); throw new IllegalStateException("Cannot add message - message limit exceeded"); } if (expirationTimer == null) { expireMessages(); } AcceptedMessage acceptedMessage = new AcceptedMessage(m); addMessage(acceptedMessage); } }  Set<AcceptedMessage> getAllMessages(); SortedSet<AcceptedMessage> getMessages(); SortedSet<AcceptedMessage> getMessages(final String tag); void addMessage(final Message m); void removeAnyMessage(Set<String> tags); void removeAnyMessage(Set<String> tags, String text); void setMessageLimit(int limit); void startExpirationTimer(); void stopExpirationTimer(); static final String MESSAGES_MAIN_PAGE_TAG; }