public void testFilter() {
KeyValuePair[] pairs = new KeyValuePair[] { new KeyValuePair("FromAccount", "211000"),
new KeyValuePair("ToAccount", "123456")};
MapFilter filter = MapFilter.createFilter(pairs, "and", null, null);
filter.start();
MapMessage msg = new MapMessage();
msg.put("ToAccount", "123456");
msg.put("FromAccount", "211000");
msg.put("Amount", "1000.00");
assertTrue(filter.isStarted());
assertTrue(filter.filter(null, Level.DEBUG, null, msg, (Throwable)null) == Filter.Result.NEUTRAL);
msg.put("ToAccount", "111111");
assertTrue(filter.filter(null, Level.ERROR, null, msg, (Throwable)null) == Filter.Result.DENY);
filter = MapFilter.createFilter(pairs, "or", null, null);
filter.start();
msg = new MapMessage();
msg.put("ToAccount", "123456");
msg.put("FromAccount", "211000");
msg.put("Amount", "1000.00");
assertTrue(filter.isStarted());
assertTrue(filter.filter(null, Level.DEBUG, null, msg, (Throwable)null) == Filter.Result.NEUTRAL);
msg.put("ToAccount", "111111");
assertTrue(filter.filter(null, Level.ERROR, null, msg, (Throwable)null) == Filter.Result.NEUTRAL);
}