|
| 1 | +package org.scoverage; |
| 2 | + |
| 3 | +import org.gradle.testkit.runner.TaskOutcome; |
| 4 | +import org.junit.Assert; |
| 5 | +import org.junit.Test; |
| 6 | + |
| 7 | +import java.io.File; |
| 8 | + |
| 9 | +public class ScalaJavaAnnotationProcessorTest extends ScoverageFunctionalTest { |
| 10 | + |
| 11 | + public ScalaJavaAnnotationProcessorTest() { |
| 12 | + super("scala-java-annotation-processor"); |
| 13 | + } |
| 14 | + |
| 15 | + @Test |
| 16 | + public void checkAndAggregateScoverage() throws Exception { |
| 17 | + |
| 18 | + AssertableBuildResult result = run("clean", ScoveragePlugin.getCHECK_NAME(), |
| 19 | + ScoveragePlugin.getAGGREGATE_NAME()); |
| 20 | + |
| 21 | + result.assertTaskSkipped("java_only:" + ScoveragePlugin.getCOMPILE_NAME()); |
| 22 | + |
| 23 | + result.assertTaskSkipped(ScoveragePlugin.getREPORT_NAME()); |
| 24 | + result.assertTaskSucceeded("mixed_scala_java:" + ScoveragePlugin.getREPORT_NAME()); |
| 25 | + result.assertTaskSkipped("java_only:" + ScoveragePlugin.getREPORT_NAME()); |
| 26 | + |
| 27 | + result.assertTaskSucceeded(ScoveragePlugin.getCHECK_NAME()); |
| 28 | + result.assertTaskSucceeded("mixed_scala_java:" + ScoveragePlugin.getCHECK_NAME()); |
| 29 | + result.assertTaskSkipped("java_only:" + ScoveragePlugin.getCHECK_NAME()); |
| 30 | + |
| 31 | + result.assertTaskSucceeded(ScoveragePlugin.getAGGREGATE_NAME()); |
| 32 | + |
| 33 | + assertAllReportFilesExist(); |
| 34 | + assertCoverage(100.0); |
| 35 | + } |
| 36 | + |
| 37 | + private void assertAllReportFilesExist() { |
| 38 | + |
| 39 | + Assert.assertTrue(resolve(reportDir(), "index.html").exists()); |
| 40 | + |
| 41 | + assertMixedScalaJavaReportFilesExist(); |
| 42 | + assertAggregationFilesExist(); |
| 43 | + } |
| 44 | + |
| 45 | + private void assertAggregationFilesExist() { |
| 46 | + |
| 47 | + Assert.assertTrue(resolve(reportDir(), "mixed_scala_java/src/main/scala/org/hello/WorldScala.scala.html").exists()); |
| 48 | + } |
| 49 | + |
| 50 | + private void assertMixedScalaJavaReportFilesExist() { |
| 51 | + |
| 52 | + File reportDir = reportDir(projectDir().toPath().resolve("mixed_scala_java").toFile()); |
| 53 | + Assert.assertTrue(resolve(reportDir, "index.html").exists()); |
| 54 | + Assert.assertTrue(resolve(reportDir, "src/main/scala/org/hello/WorldScala.scala.html").exists()); |
| 55 | + } |
| 56 | +} |
0 commit comments