diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala new file mode 100644 index 0000000000..4c2d6e8899 --- /dev/null +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala @@ -0,0 +1,19 @@ +package sbt +package internal +package inc +package javac + +import xsbti.Reporter +import xsbti.Problem + +class CollectingReporter extends Reporter { + var problems: Array[Problem] = Array[Problem]() + + def reset() = problems = Array[Problem]() + def hasErrors() = ??? + def hasWarnings(): Boolean = ??? + def printSummary(): Unit = ??? + def log(problem: xsbti.Problem): Unit = problems :+= problem + def comment(pos: xsbti.Position, msg: String): Unit = ??? + +} \ No newline at end of file diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala new file mode 100644 index 0000000000..b222c88caf --- /dev/null +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala @@ -0,0 +1,20 @@ +package sbt +package internal +package inc +package javac + +import java.io.File + +class JavaProcessLoggerSpec extends UnitSpec { + "The javac process logger" should "log errors that could not be parsed" in logUnparsableErrors() + + def logUnparsableErrors() = { + val reporter = new CollectingReporter() + val logger = new JavacLogger(log = null, reporter, cwd = new File(".")) + logger.err("javadoc: error - invalid flag: -target") + + logger.flush(-1) + + reporter.problems.length should be(1) + } +} \ No newline at end of file