Reputation: 531
I tried to define Error with typeID and cause for Mock When in MUnit
If I put cause as below shown, I got Exception as below, according to Excpetion. I assume Cause Input is expectiong Expression instead of String, but i have no glue how to write Expression for Cause Input there
Any hints are welcome!
Caused by: org.mule.runtime.core.api.config.ConfigurationException: [rest_v1_service-orders-test-suite.xml:54]: A static value ('by http not found exception') was given for parameter 'cause' but it requires an expression
at [email protected]/org.mule.runtime.module.artifact.activation.internal.ast.validation.AstValidationUtils.logWarningsAndThrowIfContainsErrors(AstValidationUtils.java:55)
Upvotes: 1
Views: 428
Reputation: 1729
The relevant documentation is here: https://docs.mulesoft.com/munit/latest/mock-event-processor#parameters
It suggests inputting the following:
#[java!java::lang::Exception::new("This is the error message")]
The java!
part indicates that the code that follows will be a Java-like expression. The java::lang::
is the namespace containing the Exception
class.
Upvotes: 1