Mule munit抛出一个特定的异常

Mule munit抛出一个特定的异常,mule,anypoint-studio,munit,Mule,Anypoint Studio,Munit,我试图在munit中抛出一个Filter unaccept异常来测试我的错误处理,但是我得到了这个错误 org.mule.api.MessagingException: Failed to invoke throw-an. at get_data_filter_unaccepted_exception-test.mock:throw-an{doc:name=Throw unaccepted Exception, exception-ref=#[new org.mule.api.routing.f

我试图在munit中抛出一个Filter unaccept异常来测试我的错误处理,但是我得到了这个错误

org.mule.api.MessagingException: Failed to invoke throw-an.
at get_data_filter_unaccepted_exception-test.mock:throw-an{doc:name=Throw unaccepted Exception, exception-ref=#[new org.mule.api.routing.filter.FilterUnacceptedException()], whenCalling=.*:.*}(get_data_from_qcfc-test-suite.xml:316)
at appleFlow.munit:test{initialState=started, description=Test, ignore=false, abstract=false, id=MunitTestFlow$$EnhancerByMUNIT$$904837f0{get_data_filter_unaccepted_exception-test}}(get_data_from_qcfc-test-suite.xml:315)
Caused by: org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "new org.mule.api.routing.filter.FilterUnacceptedException()" failed.
    at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(MVELExpressionLanguage.java:232)
这是我的一个例外

<mock:when messageProcessor=".*:.*" doc:name="Mock API Token Web Service Call">
        <mock:with-attributes>
            <mock:with-attribute name="doc:name" whereValue="#['Get API Token']"/>
        </mock:with-attributes>
        <mock:then-return payload="#[getResource('api_token_success.xml').asString()]" mimeType="application/xml"/>

    </mock:when>

我没有看到
在粘贴的代码段中抛出调用


无论如何,
org.mule.api.routing.filter.FilterUnacceptedException
的无参数构造函数不是公共的,请尝试使用
#[新建org.mule.api.routing.filter.FilterUnacceptedException('Some message')]

在粘贴的代码段中调用


无论如何,
org.mule.api.routing.filter.FilterUnacceptedException
的无参数构造函数不是公共的,请尝试使用
#[new org.mule.api.routing.filter.FilterUnacceptedException('Some message')]

您可以使用groovy组件来抛出这样的异常

<scripting:component doc:name="Throw Exception">
        <scripting:script engine="Groovy"><![CDATA[throw new org.mule.api.routing.filter.FilterUnacceptedException(); ]]></scripting:script>
    </scripting:component>

希望能有帮助


/T

您可以使用groovy组件这样抛出异常

<scripting:component doc:name="Throw Exception">
        <scripting:script engine="Groovy"><![CDATA[throw new org.mule.api.routing.filter.FilterUnacceptedException(); ]]></scripting:script>
    </scripting:component>

希望能有帮助

/T