Program: 41174
Project: 41174
Buggy source:
/** 
 * Tests that when receiving a message with the group-id, reply-to-group-id, and group-sequence fields of the AMQP properties section set, that the expected JMSX or JMS_AMQP properties are present, and the expected values are returned when retrieved from the JMS message.
 */
@Test(timeout=2000) public void testReceivedMessageWithGroupRelatedPropertiesSet() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    MessageAnnotationsDescribedType ann=null;
    String expectedGroupId="String_Node_Str";
    int expectedGroupSeq=1;
    String expectedReplyToGroupId="String_Node_Str";
    props.setGroupId(expectedGroupId);
    props.setGroupSequence(UnsignedInteger.valueOf(expectedGroupSeq));
    props.setReplyToGroupId(expectedReplyToGroupId);
    props.setMessageId("String_Node_Str");
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,ann,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull("String_Node_Str",receivedMessage);
    boolean foundGroupId=false;
    boolean foundGroupSeq=false;
    boolean foundReplyToGroupId=false;
    Enumeration<?> names=receivedMessage.getPropertyNames();
    assertTrue("String_Node_Str",names.hasMoreElements());
    while (names.hasMoreElements()) {
      Object element=names.nextElement();
      if (JmsClientProperties.JMSXGROUPID.equals(element)) {
        foundGroupId=true;
      }
      if (JmsClientProperties.JMSXGROUPSEQ.equals(element)) {
        foundGroupSeq=true;
      }
      if (AmqpMessageSupport.JMS_AMQP_REPLY_TO_GROUP_ID.equals(element)) {
        foundReplyToGroupId=true;
      }
    }
    assertTrue("String_Node_Str",foundGroupId);
    assertTrue("String_Node_Str",foundGroupSeq);
    assertTrue("String_Node_Str",foundReplyToGroupId);
    assertTrue("String_Node_Str",receivedMessage.propertyExists(JmsClientProperties.JMSXGROUPID));
    assertTrue("String_Node_Str",receivedMessage.propertyExists(JmsClientProperties.JMSXGROUPSEQ));
    assertTrue("String_Node_Str",receivedMessage.propertyExists(AmqpMessageSupport.JMS_AMQP_REPLY_TO_GROUP_ID));
    assertEquals("String_Node_Str",expectedGroupId,receivedMessage.getStringProperty(JmsClientProperties.JMSXGROUPID));
    assertEquals("String_Node_Str",expectedGroupSeq,receivedMessage.getIntProperty(JmsClientProperties.JMSXGROUPSEQ));
    assertEquals("String_Node_Str",expectedReplyToGroupId,receivedMessage.getStringProperty(AmqpMessageSupport.JMS_AMQP_REPLY_TO_GROUP_ID));
  }
 }

Fixed version (ground truth):
/** 
 * Tests that when receiving a message with the group-id, reply-to-group-id, and group-sequence fields of the AMQP properties section set, that the expected JMSX or JMS_AMQP properties are present, and the expected values are returned when retrieved from the JMS message.
 */
@Test(timeout=2000) public void testReceivedMessageWithGroupRelatedPropertiesSet() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType props=new PropertiesDescribedType();
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    MessageAnnotationsDescribedType ann=null;
    String expectedGroupId="String_Node_Str";
    int expectedGroupSeq=1;
    String expectedReplyToGroupId="String_Node_Str";
    props.setGroupId(expectedGroupId);
    props.setGroupSequence(UnsignedInteger.valueOf(expectedGroupSeq));
    props.setReplyToGroupId(expectedReplyToGroupId);
    props.setMessageId("String_Node_Str");
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,ann,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull("String_Node_Str",receivedMessage);
    boolean foundGroupId=false;
    boolean foundGroupSeq=false;
    boolean foundReplyToGroupId=false;
    Enumeration<?> names=receivedMessage.getPropertyNames();
    assertTrue("String_Node_Str",names.hasMoreElements());
    while (names.hasMoreElements()) {
      Object element=names.nextElement();
      if (JmsClientProperties.JMSXGROUPID.equals(element)) {
        foundGroupId=true;
      }
      if (JmsClientProperties.JMSXGROUPSEQ.equals(element)) {
        foundGroupSeq=true;
      }
      if (AmqpMessageSupport.JMS_AMQP_REPLY_TO_GROUP_ID.equals(element)) {
        foundReplyToGroupId=true;
      }
    }
    assertTrue("String_Node_Str",foundGroupId);
    assertTrue("String_Node_Str",foundGroupSeq);
    assertTrue("String_Node_Str",foundReplyToGroupId);
    assertTrue("String_Node_Str",receivedMessage.propertyExists(JmsClientProperties.JMSXGROUPID));
    assertTrue("String_Node_Str",receivedMessage.propertyExists(JmsClientProperties.JMSXGROUPSEQ));
    assertTrue("String_Node_Str",receivedMessage.propertyExists(AmqpMessageSupport.JMS_AMQP_REPLY_TO_GROUP_ID));
    assertEquals("String_Node_Str",expectedGroupId,receivedMessage.getStringProperty(JmsClientProperties.JMSXGROUPID));
    assertEquals("String_Node_Str",expectedGroupSeq,receivedMessage.getIntProperty(JmsClientProperties.JMSXGROUPSEQ));
    assertEquals("String_Node_Str",expectedReplyToGroupId,receivedMessage.getStringProperty(AmqpMessageSupport.JMS_AMQP_REPLY_TO_GROUP_ID));
  }
 }