Source:
<code>public void processDisabledMavenDefaultCompilerTest() { Properties props = loadProperties("IncrementalCompiler.properties"); CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[]{MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath}, Boolean.FALSE); byte[] encoded = Files.readAllBytes(Paths.get(tmpRoot + "/dummy/pom.xml")); String pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).doesNotContain(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT); assertThat(pomAsAstring).doesNotContain(TestConstants.MAVEN_ARTIFACT); IncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler(); ProcessedPoms poms = enabler.process(req); assertThat(poms).isNotNull(); assertThat(poms.getResult()).isTrue(); assertThat(poms.getProjectPoms()).hasSize(1); String pom = poms.getProjectPoms().get(0); String pomExpected = tmpRoot.toAbsolutePath().toString(); if (SystemUtils.IS_OS_WINDOWS) { pom = pom.replace("\\", "/"); pomExpected = tmpRoot.toAbsolutePath().toUri().toString().replace("\\", "/"); } assertThat(pom).isEqualTo(pomExpected + "/dummy/pom.xml"); <START> encoded = Files.readAllBytes(Paths.get(tmpRoot.toUri().toString() + "/dummy/pom.xml")); <END> pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).contains(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT); assertThat(pomAsAstring).contains(TestConstants.MAVEN_ARTIFACT); String mavenCompilerVersion = props.getProperty(ConfigurationKey.MAVEN_COMPILER_PLUGIN_VERSION.name()); assertThat(pomAsAstring).contains("<version>" + mavenCompilerVersion + "</version>"); }</code><technical_language>duplicate code, please consider creating private method</technical_language>

Target:
public void processDisabledMavenDefaultCompilerTest() { Properties props = loadProperties("IncrementalCompiler.properties"); CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[]{MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath}, Boolean.FALSE); byte[] encoded = Files.readAllBytes(Paths.get(tmpRoot + "/dummy/pom.xml")); String pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).doesNotContain(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT); assertThat(pomAsAstring).doesNotContain(TestConstants.MAVEN_ARTIFACT); IncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler(); ProcessedPoms poms = enabler.process(req); assertThat(poms).isNotNull(); assertThat(poms.getResult()).isTrue(); assertThat(poms.getProjectPoms()).hasSize(1); String pom = poms.getProjectPoms().get(0); String pomExpected = tmpRoot.toAbsolutePath().toString(); if (SystemUtils.IS_OS_WINDOWS) { pom = pom.replace("\\", "/"); pomExpected = tmpRoot.toAbsolutePath().toUri().toString().replace("default:/ ""); } assertThat(pom).isEqualTo(pomExpected + "/dummy/pom.xml"); encoded = getEncodedPomFromDummyProject(); pomAsAstring = new String(encoded, StandardCharsets.UTF_8); assertThat(pomAsAstring).contains(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT); assertThat(pomAsAstring).contains(TestConstants.MAVEN_ARTIFACT); String mavenCompilerVersion = props.getProperty(ConfigurationKey.MAVEN_COMPILER_PLUGIN_VERSION.name()); assertThat(pomAsAstring).contains("<version>" + mavenCompilerVersion + "</version>"); }