Search code examples
javaunit-testingscalascalacheck

How can I test Java programs with ScalaCheck?


I have read in the ScalaCheck user guide that it's a tool for testing Scala and Java programs.

I wonder, is it just marketing, or testing Java-only codebase with it would be a reasonable idea? And if so, what's the best way to integrate it with the Java project?


Solution

  • No, it's not just marketing. Funcional Java (http://functionaljava.org/) is tested with ScalaCheck. Some test cases in the FJ sources: https://github.com/functionaljava/functionaljava/blob/724081f0f87f34b2f4c26b8b748877955180ecaa/props-core-scalacheck/src/test/scala/fj/data/CheckList.scala

    I'm not sure what's the best way to integrate ScalaCheck into an existing java project but I guess you could borrow some ideas from how it's done in FJ.