Program: 41704
Project: 41704
Buggy source:
private void doReceivedMessageOnConnectionWithPrefixTestImpl(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)){
    Connection connection=null;
    if (destType == Topic.class) {
      connection=testFixture.establishConnecton(testPeer,"String_Node_Str" + destPrefix);
    }
 else     if (destType == Queue.class) {
      connection=testFixture.establishConnecton(testPeer,"String_Node_Str" + destPrefix);
    }
 else {
      connection=testFixture.establishConnecton(testPeer,"String_Node_Str" + destPrefix + "String_Node_Str"+ destPrefix);
    }
    connection.start();
    if (destType == Topic.class) {
      ((JmsConnection)connection).setTopicPrefix(destPrefix);
    }
 else     if (destType == Queue.class) {
      ((JmsConnection)connection).setQueuePrefix(destPrefix);
    }
    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     if (destType == TemporaryTopic.class) {
      testPeer.expectTempTopicCreationAttach(destAddress);
      dest=session.createTemporaryTopic();
    }
 else     if (destType == TemporaryQueue.class) {
      testPeer.expectTempQueueCreationAttach(destAddress);
      dest=session.createTemporaryQueue();
    }
    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 || destType == TemporaryTopic.class) {
      recievedName=((Topic)jmsDest).getTopicName();
      recievedReplyName=((Topic)jmsReplyTo).getTopicName();
    }
 else     if (destType == Queue.class || destType == TemporaryQueue.class) {
      recievedName=((Queue)jmsDest).getQueueName();
      recievedReplyName=((Queue)jmsReplyTo).getQueueName();
    }
    assertEquals("String_Node_Str",destName,recievedName);
    assertEquals("String_Node_Str",replyName,recievedReplyName);
    if (destType == TemporaryQueue.class || destType == TemporaryTopic.class) {
      assertEquals("String_Node_Str",destName,destAddress);
      assertEquals("String_Node_Str",replyName,replyAddress);
    }
  }
 }

Fixed version (ground truth):
private void doReceivedMessageOnConnectionWithPrefixTestImpl(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())){
    Connection connection=null;
    if (destType == Topic.class) {
      connection=testFixture.establishConnecton(testPeer,"String_Node_Str" + destPrefix);
    }
 else     if (destType == Queue.class) {
      connection=testFixture.establishConnecton(testPeer,"String_Node_Str" + destPrefix);
    }
 else {
      connection=testFixture.establishConnecton(testPeer,"String_Node_Str" + destPrefix + "String_Node_Str"+ destPrefix);
    }
    connection.start();
    if (destType == Topic.class) {
      ((JmsConnection)connection).setTopicPrefix(destPrefix);
    }
 else     if (destType == Queue.class) {
      ((JmsConnection)connection).setQueuePrefix(destPrefix);
    }
    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     if (destType == TemporaryTopic.class) {
      testPeer.expectTempTopicCreationAttach(destAddress);
      dest=session.createTemporaryTopic();
    }
 else     if (destType == TemporaryQueue.class) {
      testPeer.expectTempQueueCreationAttach(destAddress);
      dest=session.createTemporaryQueue();
    }
    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 || destType == TemporaryTopic.class) {
      recievedName=((Topic)jmsDest).getTopicName();
      recievedReplyName=((Topic)jmsReplyTo).getTopicName();
    }
 else     if (destType == Queue.class || destType == TemporaryQueue.class) {
      recievedName=((Queue)jmsDest).getQueueName();
      recievedReplyName=((Queue)jmsReplyTo).getQueueName();
    }
    assertEquals("String_Node_Str",destName,recievedName);
    assertEquals("String_Node_Str",replyName,recievedReplyName);
    if (destType == TemporaryQueue.class || destType == TemporaryTopic.class) {
      assertEquals("String_Node_Str",destName,destAddress);
      assertEquals("String_Node_Str",replyName,replyAddress);
    }
  }
 }