### Question:
DiscoAgentLoader implements AgentLoader { protected static ClassFileVersion parseClassFileVersionFromConfig(PreprocessConfig config) { try { if (config.getJavaVersion() == null) { log.info(PreprocessConstants.MESSAGE_PREFIX + "Java version to compile transformed classes not specified, set to Java 8 by default"); return ClassFileVersion.ofJavaVersion(8); } else { return ClassFileVersion.ofJavaVersion(Integer.parseInt(config.getJavaVersion())); } } catch (IllegalArgumentException e) { throw new InvalidConfigEntryException("java version: " + config.getJavaVersion(), e); } }  @Override void loadAgent(final PreprocessConfig config, Instrumentation instrumentation);  }### Answer:
@Test public void testParsingJavaVersionWorks() { PreprocessConfig config = PreprocessConfig.builder() .agentPath("path") .javaVersion("11") .build(); ClassFileVersion version = DiscoAgentLoader.parseClassFileVersionFromConfig(config); Assert.assertEquals(ClassFileVersion.JAVA_V11, version); PreprocessConfig anotherConfig = PreprocessConfig.builder() .agentPath("path") .build(); version = DiscoAgentLoader.parseClassFileVersionFromConfig(anotherConfig); Assert.assertEquals(ClassFileVersion.JAVA_V8, version); }
@Test(expected = InvalidConfigEntryException.class) public void testParsingJavaVersionFailsWithInvalidJavaVersion() { PreprocessConfig config = PreprocessConfig.builder() .agentPath("path") .javaVersion("a version") .build(); DiscoAgentLoader.parseClassFileVersionFromConfig(config); }