protected void assertMessagesReceivedAreValid(List<Message> receivedMessages) throws JMSException {
  List<Object> copyOfMessages=Arrays.asList(receivedMessages.toArray());
  int counter=0;
  if (data.length != copyOfMessages.size()) {
    for (Iterator<Object> iter=copyOfMessages.iterator(); iter.hasNext(); ) {
      TextMessage message=(TextMessage)iter.next();
      if (LOG.isInfoEnabled()) {
        LOG.info("<== " + counter++ + " = "+ message.getText());
      }
    }
  }
  assertEquals("Not enough messages received",data.length,receivedMessages.size());
  for (int i=0; i < data.length; i++) {
    TextMessage received=(TextMessage)receivedMessages.get(i);
    String text=received.getText();
    String stringProperty=received.getStringProperty("stringProperty");
    int intProperty=received.getIntProperty("intProperty");
    if (verbose) {
      if (LOG.isDebugEnabled()) {
        LOG.info("Received Text: " + text);
      }
    }
    assertEquals("Message: " + i,data[i],text);
    assertEquals(data[i],stringProperty);
    assertEquals(i,intProperty);
  }
}

protected void assertMessagesReceivedAreValid ( List < Message > receivedMessages ) throws JMSException { List < Object > copyOfMessages = Arrays . asList ( receivedMessages . toArray ( ) ) ; int counter = 0 ; if ( data . length != copyOfMessages . size ( ) ) { for ( Iterator < Object > iter = copyOfMessages . iterator ( ) ; iter . hasNext ( ) ; ) { TextMessage message = ( TextMessage ) iter . next ( ) ; if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "<== " + counter ++ + " = " + message . getText ( ) ) ; } } } assertEquals ( "Not enough messages received" , data . length , receivedMessages . size ( ) ) ; for ( int i = 0 ; i < data . length ; i ++ ) { TextMessage received = ( TextMessage ) receivedMessages . get ( i ) ; String text = received . getText ( ) ; String stringProperty = received . getStringProperty ( "stringProperty" ) ; int intProperty = received . getIntProperty ( "intProperty" ) ; if ( verbose ) { if ( LOG . isDebugEnabled ( ) ) { LOG . info ( "Received Text: " + text ) ; } } assertEquals ( "Message: " + i , data [ i ] , text ) ; assertEquals ( data [ i ] , stringProperty ) ; assertEquals ( i , intProperty ) ; } }
tests if the messages received are valid .
