@Test public void testConvertMessageList() { org.faktorips.runtime.MessageList ipsList = new org.faktorips.runtime.MessageList(); ipsList.add(new org.faktorips.runtime.Message.Builder("message1", org.faktorips.runtime.Severity.WARNING) .code("code").create()); ipsList.add(new org.faktorips.runtime.Message.Builder("message2", org.faktorips.runtime.Severity.ERROR) .code("code").create()); ipsList.add(new org.faktorips.runtime.Message.Builder("message3", org.faktorips.runtime.Severity.INFO) .code("code").create()); ipsList.add(new org.faktorips.runtime.Message.Builder("message4", org.faktorips.runtime.Severity.NONE) .code("code").create()); MessageList messages = MessageConverter.convert(ipsList); assertThat(messages.size(), is(4)); assertTrue(messages.stream().allMatch(m -> "code".equals(m.getCode()))); assertTrue(messages.stream().anyMatch(m -> Severity.ERROR.equals(m.getSeverity()))); assertTrue(messages.stream().anyMatch(m -> Severity.WARNING.equals(m.getSeverity()))); assertTrue(messages.stream().anyMatch(m -> Severity.INFO.equals(m.getSeverity()))); List<Message> infoMessages = messages.stream() .filter(m -> m.getSeverity() == Severity.INFO) .collect(toList()); assertThat(infoMessages, hasSize(2)); }
public static MessageList convert(org.faktorips.runtime.MessageList ipsMessages) { if (ipsMessages == null) { return new MessageList(); } return StreamUtil.stream(ipsMessages) .map(MessageConverter::convert) .collect(toMessageList()); }
MessageConverter { public static MessageList convert(org.faktorips.runtime.MessageList ipsMessages) { if (ipsMessages == null) { return new MessageList(); } return StreamUtil.stream(ipsMessages) .map(MessageConverter::convert) .collect(toMessageList()); } }
MessageConverter { public static MessageList convert(org.faktorips.runtime.MessageList ipsMessages) { if (ipsMessages == null) { return new MessageList(); } return StreamUtil.stream(ipsMessages) .map(MessageConverter::convert) .collect(toMessageList()); } private  MessageConverter(); }
MessageConverter { public static MessageList convert(org.faktorips.runtime.MessageList ipsMessages) { if (ipsMessages == null) { return new MessageList(); } return StreamUtil.stream(ipsMessages) .map(MessageConverter::convert) .collect(toMessageList()); } private  MessageConverter(); static MessageList convert(org.faktorips.runtime.MessageList ipsMessages); static Message convert(org.faktorips.runtime.Message ipsMessage); }
MessageConverter { public static MessageList convert(org.faktorips.runtime.MessageList ipsMessages) { if (ipsMessages == null) { return new MessageList(); } return StreamUtil.stream(ipsMessages) .map(MessageConverter::convert) .collect(toMessageList()); } private  MessageConverter(); static MessageList convert(org.faktorips.runtime.MessageList ipsMessages); static Message convert(org.faktorips.runtime.Message ipsMessage);  }