Check output in Maven IC tests

This commit is contained in:
Alexey Tsvetkov
2018-02-13 18:36:10 +03:00
parent 42c433f950
commit 07c94a5586
2 changed files with 21 additions and 4 deletions
@@ -1,6 +1,8 @@
package org.jetbrains.kotlin.maven;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import java.io.File;
public class IncrementalCompilationIT extends MavenITBase {
@@ -9,10 +11,20 @@ public class IncrementalCompilationIT extends MavenITBase {
MavenProject project = new MavenProject("kotlinSimple");
project.exec("package")
.succeeded()
.fileExists("target/classes/test.properties")
.filesExist(kotlinSimpleOutputPaths())
.compiledKotlin("src/main/kotlin/A.kt", "src/main/kotlin/useA.kt", "src/main/kotlin/Dummy.kt");
}
@NotNull
private String[] kotlinSimpleOutputPaths() {
return new String[]{
"target/classes/test.properties",
"target/classes/A.class",
"target/classes/UseAKt.class",
"target/classes/Dummy.class"
};
}
@Test
public void testNoChanges() throws Exception {
MavenProject project = new MavenProject("kotlinSimple");
@@ -20,6 +32,7 @@ public class IncrementalCompilationIT extends MavenITBase {
project.exec("package")
.succeeded()
.filesExist(kotlinSimpleOutputPaths())
.compiledKotlin();
}
@@ -40,6 +53,7 @@ public class IncrementalCompilationIT extends MavenITBase {
MavenTestUtils.replaceFirstInFile(aKt, replacement, original);
project.exec("package")
.succeeded()
.filesExist(kotlinSimpleOutputPaths())
.compiledKotlin("src/main/kotlin/A.kt", "src/main/kotlin/useA.kt");
}
@@ -54,6 +68,7 @@ public class IncrementalCompilationIT extends MavenITBase {
project.exec("package")
.succeeded()
.filesExist(kotlinSimpleOutputPaths())
.compiledKotlin("src/main/kotlin/A.kt", "src/main/kotlin/useA.kt");
// todo rebuild and compare output
@@ -111,12 +111,14 @@ class MavenExecutionResult {
});
}
MavenExecutionResult fileExists(@NotNull final String path) throws Exception {
MavenExecutionResult filesExist(@NotNull final String... paths) throws Exception {
return check(new Action<MavenExecutionResult>() {
@Override
public void run(MavenExecutionResult execResult) {
File file = new File(workingDir, path);
Assert.assertTrue(file + " does not exist", file.exists());
for (String path : paths) {
File file = new File(workingDir, path);
Assert.assertTrue(file + " does not exist", file.exists());
}
}
});
}