0
我想用scalatest來測試一個類。這是我試圖運行測試:Scalatest + maven
@RunWith(classOf[JUnitRunner])
class CategorizationSpec extends FlatSpec with BeforeAndAfter with Matchers{
var ss:SparkSession = _
before{
System.setProperty("hadoop.home.dir", "/opt/spark-2.0.0-bin-hadoop2.7");
val conf = new SparkConf(true)
.set("spark.cassandra.connection.host","localhost")
.set("spark.sql.crossJoin.enabled","true")
.set("spark.executor.memory","4g")
Logger.getLogger("org").setLevel(Level.OFF)
Logger.getLogger("akka").setLevel(Level.OFF)
ss = SparkSession
.builder()
.master("local")
.appName("categorization")
.config(conf)
.getOrCreate()
ss.conf.set("spark.cassandra.connection.host","localhost")
}
"DictionaryPerUser" should "be empty" in {
val dpuc=new DictionaryPerUserController(ss)
dpuc.truncate()
dpuc.getDictionary shouldBe null
}
}
,但我得到了以下錯誤:
[ERROR] /path/project/datasystem/CategorizationSpec.scala:3: error: object controllers is not a member of package path.project.datasystem [ERROR] import path.project.datasystem.controllers.DictionaryPerUserController
但我在/ src目錄班級/主/斯卡拉/路徑/工程和測試class在/ src/test/scala/path/project中
你知道嗎?
你的pom設置如何? –
如果您解決了該問題,則應將解決方案作爲答案發布並接受該答案。 –