}
@Test
public void testConfig() {
final LoggerContext ctx = Configurator.initialize("Test1", "target/test-classes/log4j2-mapfilter.xml");
final Configuration config = ctx.getConfiguration();
final Filter filter = config.getFilter();
assertNotNull("No MapFilter", filter);
assertTrue("Not a MapFilter", filter instanceof MapFilter);
final MapFilter mapFilter = (MapFilter) filter;
assertFalse("Should not be And filter", mapFilter.isAnd());
final Map<String, List<String>> map = mapFilter.getMap();
assertNotNull("No Map", map);
assertTrue("No elements in Map", map.size() != 0);
assertTrue("Incorrect number of elements in Map", map.size() == 1);
assertTrue("Map does not contain key eventId", map.containsKey("eventId"));
assertTrue("List does not contain 2 elements", map.get("eventId").size() == 2);
final Logger logger = LogManager.getLogger(MapFilterTest.class);
final Map<String, String> eventMap = new HashMap<String, String>();
eventMap.put("eventId", "Login");
logger.debug(new MapMessage(eventMap));
final Map<String,Appender> appenders = config.getAppenders();
final Appender app = appenders.get("LIST");
assertNotNull("No List appender", app);
final List<String> msgs = ((ListAppender) app).getMessages();
assertNotNull("No messages", msgs);
assertTrue("No messages", msgs.size() > 0);