blob: 43c08492c714df9ef1c1394c14b421e902d5411d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package com.yahoo.example.blog
import org.apache.spark.sql.{SparkSession, DataFrame}
import org.scalatest.Matchers._
import org.scalatest._
class SplitFullSetIntoTrainAndTestSetsTest extends FunSuite with BeforeAndAfter {
var ss: SparkSession = _
before {
ss = SparkSession
.builder()
.appName("Unit Test")
.master("local[*]")
.getOrCreate()
}
after {
ss.stop()
}
test("SplitFullSetIntoTrainAndTestSets should return an Array of DataFrame") {
val file_path = getClass.getResource("/trainPostsSample.json")
val splitter = new SplitFullSetIntoTrainAndTestSets(ss)
val sets = splitter.run(input_file_path = file_path.toString,
test_perc_stage1 = 0.05,
test_perc_stage2 = 0.15,
seed = 123)
sets shouldBe a [Array[DataFrame]]
}
}
|