Ihar Hancharenka 5dff80e88e first
2023-03-27 16:52:17 +03:00

46 строки
982 B
Plaintext

FunSuite
FlatSpec
FunSpec
WordSpec
FreeSpec
Spec
PropSpec
FeatureSpec
PropSpec
import org.staclatest._
import prop._
import scala.collection.immutable._
class SetSpec extends PropSpec with TableDrivenPropertyChecks with Matchers {
val examples =
Table(
"set",
BitSet.empty,
HashSet.empty[Int],
TreeSet.empty[Int]
)
property("an empty Set should have size 0") {
forAll(examples) { set =>
set.size should be (0)
}
}
property("invoking head on an empty set should produce NoSuchElementException") {
forAll(examples) { set =>
a [NoSuchElementException] should be thrownBy { set.head }
}
}
}
Defining base class
trait MovioSpec extends FunSpecLike
with ShouldMatchers
with OptionValues
with EitherValues
with BeforeAndAfter // before/after
with BeforeAndAfterEach //
with BeforeAndAfterAll //
with UtcTime