@Test
public void testIterator() {

    ResultMessage msg1 = ResultMessage.fromCode("foo", "aa");
    ResultMessage msg2 = ResultMessage.fromCode("bar", "bb");
    ResultMessages messages = new ResultMessages((ResultMessageType) ERROR);
    messages.addAll(Arrays.asList(msg1, msg2));
    List<ResultMessage> result = new ArrayList<ResultMessage>();
    for (ResultMessage message : messages) {
        result.add(message);
    }
    assertThat(result, is(Arrays.asList(msg1, msg2)));
}