@Test
public void findsProblemsInJavaFiles() throws Exception {

    final String file = "src/main/java/Main.java";
    final Environment env = new Environment.Mock()
        .withFile(file, "class Main { int x = 0; }");
    MatcherAssert.assertThat(
        new PmdValidator(env).validate(
            Collections.singletonList(new File(env.basedir(), file))
        ),
        Matchers.not(Matchers.<Violation>empty())
    );
}