{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getProperty("param", PropertyScope.INBOUND)).thenReturn(new Object());
return command.messageHas("param", message);
}
})));
verify(context).declareFunction(eq("messageHasInboundPropertyCalled"), argThat(functionMatcher(MessageHasElementAssertionMelFunction.class, new CommandValidator<MessageHasElementAssertionCommand>()
{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getInboundProperty("param")).thenReturn(new Object());
return command.messageHas("param", message) && !command.messageHas("param2", message);
}
})));
verify(context).declareFunction(eq("messageHasOutboundPropertyCalled"), argThat(functionMatcher(MessageHasElementAssertionMelFunction.class, new CommandValidator<MessageHasElementAssertionCommand>()
{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getOutboundProperty("param")).thenReturn(new Object());
return command.messageHas("param", message) && !command.messageHas("param2", message);
}
})));
verify(context).declareFunction(eq("messageHasSessionPropertyCalled"), argThat(functionMatcher(MessageHasElementAssertionMelFunction.class, new CommandValidator<MessageHasElementAssertionCommand>()
{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getProperty("param", PropertyScope.SESSION)).thenReturn(new Object());
return command.messageHas("param", message) && !command.messageHas("param2", message);
}
})));
verify(context).declareFunction(eq("messageHasInvocationPropertyCalled"), argThat(functionMatcher(MessageHasElementAssertionMelFunction.class, new CommandValidator<MessageHasElementAssertionCommand>()
{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getInvocationProperty("param")).thenReturn(new Object());
return command.messageHas("param", message) && !command.messageHas("param2", message);
}
})));
verify(context).declareFunction(eq("messageHasInboundAttachmentCalled"), argThat(functionMatcher(MessageHasElementAssertionMelFunction.class, new CommandValidator<MessageHasElementAssertionCommand>()
{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getInboundAttachment("param")).thenReturn(new DataHandler(new Object(), "url"));
return command.messageHas("param", message) && !command.messageHas("param2", message);
}
})));
verify(context).declareFunction(eq("messageHasOutboundAttachmentCalled"), argThat(functionMatcher(MessageHasElementAssertionMelFunction.class, new CommandValidator<MessageHasElementAssertionCommand>()
{
@Override
public boolean validate(MessageHasElementAssertionCommand command)
{
MuleMessage message = mock(MuleMessage.class);
when(message.getOutboundAttachment("param")).thenReturn(new DataHandler(new Object(), "url"));
return command.messageHas("param", message) && !command.messageHas("param2", message);
}
})));
verify(context).declareFunction(eq("messageInboundProperty"), argThat(assertMatcher(MessageMatchingAssertionMelFunction.class, new CommandValidator<ElementMatcherFactory>()
{
@Override
public boolean validate(ElementMatcherFactory command)
{
MuleMessage message = mock(MuleMessage.class);
command.build("param", message);
verify(message).getInboundProperty("param");
return true;
}
})));
verify(context).declareFunction(eq("messageOutboundProperty"), argThat(assertMatcher(MessageMatchingAssertionMelFunction.class, new CommandValidator<ElementMatcherFactory>()
{
@Override
public boolean validate(ElementMatcherFactory command)
{
MuleMessage message = mock(MuleMessage.class);
command.build("param", message);
verify(message).getOutboundProperty("param");
return true;
}
})));
verify(context).declareFunction(eq("messageInvocationProperty"), argThat(assertMatcher(MessageMatchingAssertionMelFunction.class, new CommandValidator<ElementMatcherFactory>()
{
@Override
public boolean validate(ElementMatcherFactory command)
{
MuleMessage message = mock(MuleMessage.class);
command.build("param", message);
verify(message).getInvocationProperty("param");
return true;
}
})));
verify(context).declareFunction(eq("messageInboundAttachment"), argThat(assertMatcher(MessageMatchingAssertionMelFunction.class, new CommandValidator<ElementMatcherFactory>()
{
@Override
public boolean validate(ElementMatcherFactory command)
{
MuleMessage message = mock(MuleMessage.class);
command.build("param", message);
verify(message).getInboundAttachment("param");
return true;
}
})));
verify(context).declareFunction(eq("messageOutboundAttachment"), argThat(assertMatcher(MessageMatchingAssertionMelFunction.class, new CommandValidator<ElementMatcherFactory>()
{
@Override
public boolean validate(ElementMatcherFactory command)
{
MuleMessage message = mock(MuleMessage.class);
command.build("param", message);
verify(message).getOutboundAttachment("param");
return true;