Program: 41715
Project: 41715
Buggy source:
private void doReceivedMessageOnConnectionWithBrokerDefinedPrefixPropertiesTestImpl(Class<? extends Destination> destType,String destPrefix,String destName,String replyName,String destAddress,String replyAddress,String annotationName,Object annotationValue,String replyAnnotationName,Object replyAnnotationValue) throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Map<Symbol,Object> properties=new HashMap<Symbol,Object>();
    properties.put(AmqpConnectionProperties.QUEUE_PREFIX,destPrefix);
    properties.put(AmqpConnectionProperties.TOPIC_PREFIX,destPrefix);
    Connection connection=testFixture.establishConnecton(testPeer,null,null,properties);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Destination dest=null;
    if (destType == Topic.class) {
      dest=session.createTopic(destName);
    }
 else     if (destType == Queue.class) {
      dest=session.createQueue(destName);
    }
 else {
      fail("String_Node_Str");
    }
    MessageAnnotationsDescribedType msgAnnotations=null;
    if (annotationName != null || replyAnnotationName != null) {
      msgAnnotations=new MessageAnnotationsDescribedType();
      if (annotationName != null) {
        msgAnnotations.setSymbolKeyedAnnotation(annotationName,annotationValue);
      }
      if (replyAnnotationName != null) {
        msgAnnotations.setSymbolKeyedAnnotation(replyAnnotationName,replyAnnotationValue);
      }
    }
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setTo(destAddress);
    props.setReplyTo(replyAddress);
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    SourceMatcher sourceMatcher=new SourceMatcher();
    sourceMatcher.withAddress(equalTo(destAddress));
    testPeer.expectReceiverAttach(notNullValue(),sourceMatcher);
    testPeer.expectLinkFlowRespondWithTransfer(null,msgAnnotations,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(dest);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(2000);
    assertNotNull(receivedMessage);
    Destination jmsDest=receivedMessage.getJMSDestination();
    Destination jmsReplyTo=receivedMessage.getJMSReplyTo();
    assertNotNull("String_Node_Str",jmsDest);
    assertNotNull("String_Node_Str",jmsReplyTo);
    String recievedName=null;
    String recievedReplyName=null;
    if (destType == Topic.class) {
      recievedName=((Topic)jmsDest).getTopicName();
      recievedReplyName=((Topic)jmsReplyTo).getTopicName();
    }
 else     if (destType == Queue.class) {
      recievedName=((Queue)jmsDest).getQueueName();
      recievedReplyName=((Queue)jmsReplyTo).getQueueName();
    }
    assertEquals("String_Node_Str",destName,recievedName);
    assertEquals("String_Node_Str",replyName,recievedReplyName);
  }
 }

Fixed version (ground truth):
private void doReceivedMessageOnConnectionWithBrokerDefinedPrefixPropertiesTestImpl(Class<? extends Destination> destType,String destPrefix,String destName,String replyName,String destAddress,String replyAddress,String annotationName,Object annotationValue,String replyAnnotationName,Object replyAnnotationValue) throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Map<Symbol,Object> properties=new HashMap<Symbol,Object>();
    properties.put(AmqpConnectionProperties.QUEUE_PREFIX,destPrefix);
    properties.put(AmqpConnectionProperties.TOPIC_PREFIX,destPrefix);
    Connection connection=testFixture.establishConnecton(testPeer,null,null,properties);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Destination dest=null;
    if (destType == Topic.class) {
      dest=session.createTopic(destName);
    }
 else     if (destType == Queue.class) {
      dest=session.createQueue(destName);
    }
 else {
      fail("String_Node_Str");
    }
    MessageAnnotationsDescribedType msgAnnotations=null;
    if (annotationName != null || replyAnnotationName != null) {
      msgAnnotations=new MessageAnnotationsDescribedType();
      if (annotationName != null) {
        msgAnnotations.setSymbolKeyedAnnotation(annotationName,annotationValue);
      }
      if (replyAnnotationName != null) {
        msgAnnotations.setSymbolKeyedAnnotation(replyAnnotationName,replyAnnotationValue);
      }
    }
    PropertiesDescribedType props=new PropertiesDescribedType();
    props.setTo(destAddress);
    props.setReplyTo(replyAddress);
    DescribedType amqpValueNullContent=new AmqpValueDescribedType(null);
    SourceMatcher sourceMatcher=new SourceMatcher();
    sourceMatcher.withAddress(equalTo(destAddress));
    testPeer.expectReceiverAttach(notNullValue(),sourceMatcher);
    testPeer.expectLinkFlowRespondWithTransfer(null,msgAnnotations,props,null,amqpValueNullContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(dest);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(2000);
    assertNotNull(receivedMessage);
    Destination jmsDest=receivedMessage.getJMSDestination();
    Destination jmsReplyTo=receivedMessage.getJMSReplyTo();
    assertNotNull("String_Node_Str",jmsDest);
    assertNotNull("String_Node_Str",jmsReplyTo);
    String recievedName=null;
    String recievedReplyName=null;
    if (destType == Topic.class) {
      recievedName=((Topic)jmsDest).getTopicName();
      recievedReplyName=((Topic)jmsReplyTo).getTopicName();
    }
 else     if (destType == Queue.class) {
      recievedName=((Queue)jmsDest).getQueueName();
      recievedReplyName=((Queue)jmsReplyTo).getQueueName();
    }
    assertEquals("String_Node_Str",destName,recievedName);
    assertEquals("String_Node_Str",replyName,recievedReplyName);
  }
 }