is it possible to nest following specs test code
"ClassX" should {
"throw an IllegalArgumentException if n < 0" in {
ClassX(-1) must throwA[IllegalArgumentException]
}
"throw an IllegalArgumentException if n > 50" in {
ClassX(51) must throwA[IllegalArgumentException]
}
"throw an IllegalArgumentException if n == 35" in {
ClassX(35) must throwA[IllegalArgumentException]
}
}
in another in-Statement like:
"ClassX" should {
"throw an IllegalArgumentException if" in {
"n < 0" in {
ClassX(-1) must throwA[IllegalArgumentException]
}
"n > 50" in {
ClassX(51) must throwA[IllegalArgumentException]
}
"n == 35" in {
ClassX(35) must throwA[IllegalArgumentException]
}
}
}
Because it is easier to read and write
Yes. See http://code.google.com/p/specs/wiki/DeclareSpecifications for an overview of all the ways you can structure Specs specifications.