ScalaTest
依赖
<!--依赖-->
<dependencies>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
代码
package zhangxiaofan.object_static
import org.scalatest.FunSuite
/**
* @author ZhangXiaoFan
* @create 2020-10-18 23:48
*/
class UserTest extends FunSuite {
//差集
test("Test difference") {
val a = Set("a", "b", "a", "c")
val b = Set("b", "d")
assert(a -- b === Set("a", "c"))
println("Test difference")
}
//交集
test("Test intersection") {
val a = Set("a", "b", "a", "c")
val b = Set("b", "d")
assert(a.intersect(b) === Set("b"))
}
//并集
test("Test union") {
val a = Set("a", "b", "a", "c")
val b = Set("b", "d")
assert(a ++ b === Set("a", "b", "c", "d"))
}
}