0

I have java Munit test in which I am verifying call to <file:outbound-endpoint> like this:

verifyCallOfMessageProcessor("outbound-endpoint")
    .ofNamespace("file")
    .withAttributes(attribute("path").withValue("/data/local/"),
                    attribute("outputPattern").withValue("vendor_customer_*"))
    .times(1)
    ;

This snippet is supposed to test below Mule code:

<file:outbound-endpoint path="${root.drive}"
                outputPattern="vendor_customer_#[server.dateTime.format('YYYY_MM_dd_hh_mm_ss.sss')].csv" />

How to use regular expression in attribute("outputPattern").withValue("vendor_customer_*")) to say that attribute value startsWith vendor_customer_

I am using MUnit 3.5 with Mule 3.4.2

Charu Khurana
  • 4,511
  • 8
  • 47
  • 81

1 Answers1

0

There is no RegEx support for the attribute value. You need put exactly what the value will be. Please take a look at: https://docs.mulesoft.com/mule-user-guide/v/3.7/the-mock-message-processor#matchers

As a side note, please notice that MUnit provides no support for testing Mule 3.4.

HTH

Dds
  • 712
  • 5
  • 7
  • Can you suggest how do I put exact value in this case for attribute `outputPattern` – Charu Khurana Oct 07 '15 at 15:40
  • Well the problem you have there is that the date is too granular (millisecond level) I reckon that's follows some business logic. So in this case there is nothing you can do. You could make the variable part of the file name to be just the date but that may not be an option. On the other hand if you are already using the path attribute you may no need to add a new one. – Dds Oct 07 '15 at 17:26