PomXpathValidator implements MavenValidator { @Override public void validate(final MavenEnvironment env) throws ValidationException { PomXpathValidator.validate(PomXpathValidator.pom(env), env.asserts()); }  @Override void validate(final MavenEnvironment env);  }
@Test public void canValidatePomWithXpath() throws Exception { final MavenEnvironment env = new MavenEnvironmentMocker() .withAsserts( Collections.singletonList( "/pom:project/pom:dependencies/pom:dependency[pom:artifactId='commons-io']/pom:version[.='1.2.5']/text()" ) ).mock(); final String pom = new TextOf( new ResourceOf("com/qulice/maven/PomXpathValidator/pom.xml") ).asString(); FileUtils.write( new File( String.format( "%s%spom.xml", env.basedir(), File.separator ) ), pom, StandardCharsets.UTF_8 ); new PomXpathValidator().validate(env); }