This code will look for the values in the 5th field of the 2nd OBX segment ('OBX[2]-5') and make the change to OBR-4.2 if the value is found:
if (StringUtils.equalsIgnoreCase(source.getNode('OBX[2]-5'), 'colonoscopy')) {
message.setNode('OBR-4.2', 'Colonoscopy');
} else {
if (StringUtils.equalsIgnoreCase(source.getNode('OBX[2]-5'), 'Upper GI endoscopy')) {
message.setNode('OBR-4.2', 'UGI ENDOSCOP');
}
}