@Test
public void testMergeMessages() {

    Collection<Message> messages1 = new ArrayList<Message>();
    Collection<Message> messages2 = new ArrayList<Message>();
    MessageBuilder builder = MessageBuilder.create("Default", "All", "Test Message");
    Message message1 = builder.build();
    builder.setKey("Test Message 2");
    Message message2 = builder.build();
    builder.setComponentCode("TestView");
    Message message3 = builder.build();
    builder.setNamespaceCode("KR-SAP");
    Message message4 = builder.build();
    Message message5 = builder.build();
    messages1.add(message1);
    messages1.add(message2);
    messages1.add(message4);
    messages2.add(message1);
    messages2.add(message3);
    messages2.add(message4);
    messages2.add(message5);
    MessageServiceImpl messageServiceImpl = new MessageServiceImpl();
    messageServiceImpl.mergeMessages(messages1, messages2);
    assertEquals("Merged map is not correct size", 5, messages1.size());
}