mule - Is there a way to mock non-global filters in a sub-flow using MUnit? -


i wanted know if there way mock custom-filter within sub-flow using munit.

i'm using mule 3.4.0 , munit 3.4.0.m5.

the sample flow looks following.

<sub-flow name="a">      <choice>           <when expression="something...">                <custom-filter doc:name="filter a">...</custom-filter>           </when>           <otherwise>                ...           </otherwise>      </choice> </sub-flow> 

i've had create wrapper flow around subflow because nullpointerexception whenever try hit sub flow directly using runflow syntax. however, in doing so, unable mock custom-filter using whenmessageprocessor syntax. please see attempt below.

whenmessageprocessor("custom-filter" .withattributes(attribute("name").ofnamespace("doc").withvalue("filter a")) .thenreturn(mulemessagewithpayload("some response"); 

this results in message not being mocked.

there issues here mixed up.

you having wrap sub-flow munit/mule issue commented here: how mock java component within mule flow using munit

the second issue filter mocking. short answer can not, please check: https://github.com/mulesoft/munit/issues/108

conceptually filter shorthanded way of doing choice (or if in normal language). 1 not mock choice/if rather changes value in variable or in our case in mule message payload. that's why filter mp can not mocked.

hth


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -