@Test
public void testFilterWithInvalidElements()
        throws URISyntaxException, IOException, SAXException, ParserConfigurationException, ConfigurationException {

    try (InputStream input = this.getClass()
            .getResourceAsStream("/invalid-package/META-INF/vault/filter.xml")) {
        validator = new AdvancedFilterValidator(
                factory,
                ValidationMessageSeverity.WARN,
                AdvancedFilterValidatorFactory.DEFAULT_SEVERITY_FOR_UNCOVERED_ANCESTOR_NODES,
                ValidationMessageSeverity.ERROR,
                ValidationMessageSeverity.ERROR,
                false,
                dependenciesMetaInfo,
                filter,
                validRoots);
        Collection<ValidationMessage> messages = validator.validateMetaInfData(input, Paths.get("vault/filter.xml"), Paths.get(""));
        ValidationExecutorTest.assertViolation(messages,
                new ValidationMessage(ValidationMessageSeverity.WARN,
                        "cvc-complex-type.3.2.2: Attribute 'mode' is not allowed to appear in element 'exclude'.", 20, 51, null),
                new ValidationMessage(ValidationMessageSeverity.WARN,
                        "cvc-complex-type.2.4.a: Invalid content was found starting with element 'invalidelement'. One of '{exclude, include}' is expected.",
                        22, 27, null),
                new ValidationMessage(ValidationMessageSeverity.WARN, AdvancedFilterValidator.MESSAGE_INVALID_FILTER_XML)); // because
                                                                                                                            // of
                                                                                                                            // invalid
                                                                                                                            // regex
    }
}