### Question:
PmdTemplate { public static PmdTemplate create(String javaVersion, ClassLoader classloader, Charset charset) { PMDConfiguration configuration = new PMDConfiguration(); List<LanguageVersion> languageVersions = new ArrayList<>(); languageVersions.add(languageVersion(javaVersion)); configuration.setDefaultLanguageVersions(languageVersions); configuration.setClassLoader(classloader); configuration.setSourceEncoding(charset.name()); SourceCodeProcessor processor = new SourceCodeProcessor(configuration); return new PmdTemplate(configuration, processor); } @VisibleForTesting  PmdTemplate(PMDConfiguration configuration, SourceCodeProcessor processor); static PmdTemplate create(String javaVersion, ClassLoader classloader, Charset charset); void process(File file, RuleSets rulesets, RuleContext ruleContext);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void should_fail_on_invalid_java_version() { PmdTemplate.create("12.2", mock(ClassLoader.class), Charsets.UTF_8); }
@Test public void shouldnt_fail_on_valid_java_version() { PmdTemplate.create("6", mock(ClassLoader.class), Charsets.UTF_8); }