store2.addMessageToGroup( 3, new GenericMessage<String>( "3A" ) );
Iterator<MessageGroup> messageGroups = store1.iterator();
int counter = 0;
while ( messageGroups.hasNext() ) {
final MessageGroup group = messageGroups.next();
final String groupId = (String) group.getGroupId();
if ( "1".equals( groupId ) ) {
Assert.assertEquals( 1, group.getMessages().size() );
}
else if ( "2".equals( groupId ) ) {
Assert.assertEquals( 1, group.getMessages().size() );
}
else if ( "3".equals( groupId ) ) {
Assert.assertEquals( 2, group.getMessages().size() );
}
++counter;
}
Assert.assertEquals( 3, counter );