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

    final String file = "src/main/java/foo/Foo.java";
    final Environment env = new Environment.Mock().withFile(
        file,
        Joiner.on('\n').join(
            "package foo;",
            "interface Foo {",
            "  final class Bar implements Foo {",
            "    private static final Pattern TEST =",
            "      Pattern.compile(\"hey\");",
            "    public String doSomething() {",
            "      return Foo.Bar.TEST.toString();",
            "    }",
            "  }",
            "}"
        )
    );
    MatcherAssert.assertThat(
        new PmdValidator(env).validate(
            Collections.singletonList(new File(env.basedir(), file))
        ),
        Matchers.<Violation>empty()
    );
}