ResultMessages implements Serializable, Iterable<ResultMessage> { @Deprecated public static ResultMessages warn() { return new ResultMessages(WARN); } 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; }
@SuppressWarnings("deprecation") @Test public void testWarn() { ResultMessage msg1 = ResultMessage.fromCode("foo", "aa"); ResultMessage msg2 = ResultMessage.fromCode("bar", "bb"); ResultMessages messages = ResultMessages.warn().add("foo", "aa").add( "bar", "bb"); assertThat(messages.getType(), is((ResultMessageType) WARN)); assertThat(messages.getList(), is(Arrays.asList(msg1, msg2))); }