### Question:
PatternMetricFilter implements MetricFilter { public static MetricFilter parse(Configs configs, Config config) { Preconditions.checkNotNull(configs); Preconditions.checkNotNull(config); Config filterConfig = configs.getConfig(config, "metricFilter", null); if (filterConfig == null) { return MetricFilter.ALL; } else { return new PatternMetricFilter(filterConfig); } } private  PatternMetricFilter(Config config); static MetricFilter parse(Configs configs, Config config); @Override boolean matches(String name, Metric metric); @Override String toString();  }### Answer:
@Test public void testUnrecognizedPatternType() throws Exception { String str = "{" + "\n metricFilter : {" + "\n includes : { " + "\n \"unRecognizedType:foo\" : \"glob:*\"" + "\n }" + "\n }}"; Config config = ConfigFactory.parseString(str); try { PatternMetricFilter.parse(new Configs(), config); fail(); } catch (MorphlineCompilationException e) { ; } }
@Test public void testIllegalPatternType() throws Exception { String str = "{" + "\n metricFilter : {" + "\n includes : { " + "\n \"ILLEGAL\" : \"glob:*\"" + "\n }" + "\n }}"; Config config = ConfigFactory.parseString(str); try { PatternMetricFilter.parse(new Configs(), config); fail(); } catch (MorphlineCompilationException e) { ; } }