Search code examples
muleanypoint-studiomunit

Mulesoft MEL Expression Get String Value Of Payload Data Type


I want to extract my payload's class name in a MUnit assert so I can verify the payload is always of the correct type. I've tried 2 MEL expressions, but both return null in the MEL expression evaluator. The funny thing is that if I remove the .name part of the expression then I see a key called "name" with the value that I need. Any ideas?

payload.class.name
message.dataType.type.name

Solution

  • One way is: #[payload.getClass().getSimpleName()]