Defining CAN data for off line trials

I am working on a project with CAN shield + MEGA2560.

Angle information from an encoder is received and decoded as required. The following code snippet does this :

 if ((rxId & 0x1FFFFFFF) == 0x18FF0108) {        // Determine if message is a required one...
      for (byte i = 0; i < len; i++) {
        sprintf(msgString, " 0x%.2X", rxBuf[i]);
        Serial.print(msgString);
      }
      float angleVal = (rxBuf[4] << 8) | rxBuf[3];  // Process the data  for angle information.
      Serial.print("Angle in Deg.: ");
      if (angleVal > 2047) {
         ((angleVal - 4095) * 180 / 2048);
      } else {
         angleVal * 180 / 2048;
      }
      Serial.println( angleVal); 
    } 

Now I want to test above for various angles and right now do not have the hardware . So I have to inject CAN data into the above code and see how it handles different values and there are other functions ( not shown here for keeping the post small ) . The sample CAN data will be like this : 7B 66 7E 99 7D E6 00 00

In other words I need to load msgString variable with the above Hex data .

Thanks for any tips on this .

Maybe for this purpose I will avoid the msgString and define a byte array ??

how do you know? have you tested it with the encoder?

I assume you mean you don't have the encoder and wish to test the CAN shield + MEGA2560 hardware and software
probably simplest way is to get another microcontroller + CAN shield and program it to generate the data sequences required
or a USB-CAN adapter (search on EBAY) and program a PC to generate the data

how do you know? have you tested it with the encoder? YES.

I assume you mean you don't have the encoder and wish to test the CAN shield + MEGA2560 hardware and software I dont even have the CAN Shield . Just the Mega2560. I will comment all CAN related code and just test the logic of data parsing .