@Test
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public void understandsMethodReferences() throws Exception {

    final String file = "src/main/java/Other.java";
    final Environment env = new Environment.Mock().withFile(
        file,
        Joiner.on('\n').join(
            "import java.util.ArrayList;",
            "class Other {",
            "    public static void test() {",
            "        new ArrayList<String>().forEach(Other::other);",
            "    }",
            "    private static void other(String some) {// body}",
            "}"
        )
    );
    final Collection<Violation> violations = new PmdValidator(env).validate(
        Collections.singletonList(new File(env.basedir(), file))
    );
    MatcherAssert.assertThat(
        violations,
        Matchers.<Violation>empty()
    );
}