{
AndFilter filter = new AndFilter();
assertEquals(0, filter.getFilters().size());
// both null
assertFalse(filter.accept(new DefaultMuleMessage("foo", muleContext)));
// only one filter set
filter.getFilters().add(new EqualsFilter("foo"));
assertTrue(filter.accept(new DefaultMuleMessage("foo", muleContext)));
// another one set too, but does not accept
filter.getFilters().add(new EqualsFilter("foo"));
assertFalse(filter.accept(new DefaultMuleMessage("bar", muleContext)));
// both accept
assertTrue(filter.accept(new DefaultMuleMessage("foo", muleContext)));
WildcardFilter left = new WildcardFilter("blah.blah.*");
WildcardFilter right = new WildcardFilter("blah.*");
filter = new AndFilter(left, right);
assertEquals(2,filter.getFilters().size());
assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
assertTrue(right.accept(new DefaultMuleMessage("blah.blah", muleContext)));
assertTrue(!left.accept(new DefaultMuleMessage("blah.blah", muleContext)));
assertTrue(!filter.accept(new DefaultMuleMessage("blah.blah", muleContext)));
filter = new AndFilter();
filter.getFilters().add(left);
filter.getFilters().add(right);
assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
assertTrue(!filter.accept(new DefaultMuleMessage("blah.blah", muleContext)));
}