79500471

Date: 2025-03-11 10:55:16
Score: 0.5
Natty:
Report link

Correct way to mock sftp-list operation where attributes can be available inside foreach loop:

\<flow doc:name="Flow" \>

\<file:list doc:name="List" config-ref="File_Config" directoryPath="/tmp/"/\>

\</flow\>

\<munit-tools:mock-when processor="file:list"\>

\<munit-tools:with-attributes\>

   \<munit-tools:with-attribute attributeName="doc:name" whereValue="List"/\>

\</munit-tools:with-attributes\>

\<munit-tools:then-return\>

   \<munit-tools:payload value="#\[\[MunitTools::createMessage( &quot;ITEM-1&quot;,  &quot;text/plain&quot;, { property : 'ATTRIBUTE-1'}, null) , MunitTools::createMessage( &quot;ITEM-2&quot;,  &quot;text/plain&quot;, { property : 'ATTRIBUTE-2'}, null)\]\]" /\>

 \</munit-tools:then-return\>

 \</munit-tools:mock-when\>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: PSAFOL