A big shout out to those who wrote this awesome tool that takes in code and formats it in html so that you can paste it in your blog
http://codeformatter.blogspot.com/
http://codeformatter.blogspot.com/
import org.specs2.Specification
import org.specs2.mock.Mockito
import org.apache.spark.SparkContext
trait SparkTests extends Specification{
var sc: SparkContext = _
def runTest[A](name: String)(body: => A): A = {
System.clearProperty("spark.driver.port")
System.clearProperty("spark.hostPort")
sc = new SparkContext("local[4]", name)
try{
println("Running test " + name)
body
}
finally {
sc.stop
System.clearProperty("spark.driver.port")
System.clearProperty("spark.hostPort")
sc = null
}
}
}
class LogPreprocessorSpec extends Specification with Mockito with ScalaCheck with SparkTests {
sequential
testOptions in Test += Tests.Argument("sequential")