There are many ways to write test for it. There are libraries like FlatSpec, FunSuit.
So here, i am going to write test case for it using FunSuit
import org.scalatest.FunSuite
class WordTest extends FunSuite {
test("should return word count ") {
val wordCount = Word.readFile()
assert(wordCount.nonEmpty)
}
}
solved How to write scalatest unit test for scala object? [closed]