ResultMessages implements Serializable, Iterable<ResultMessage> { public List<ResultMessage> getList() { return list; } ResultMessages(ResultMessageType type);  ResultMessages(ResultMessageType type, ResultMessage... messages); ResultMessageType getType(); List<ResultMessage> getList(); ResultMessages add(ResultMessage message); ResultMessages add(String code); ResultMessages add(String code, Object... args); ResultMessages addAll(ResultMessage... messages); ResultMessages addAll(Collection<ResultMessage> messages); boolean isNotEmpty(); static ResultMessages success(); static ResultMessages info(); @Deprecated static ResultMessages warn(); static ResultMessages warning(); static ResultMessages error(); static ResultMessages danger(); @Override Iterator<ResultMessage> iterator(); @Override String toString(); static final String DEFAULT_MESSAGES_ATTRIBUTE_NAME; }
@Test public void testGetMessages() { ResultMessage msg1 = ResultMessage.fromCode("foo"); ResultMessage msg2 = ResultMessage.fromCode("bar"); ResultMessages messages = new ResultMessages((ResultMessageType) ERROR, msg1, msg2); assertThat(messages.getList(), is(Arrays.asList(msg1, msg2))); }