Can someone tell me what "Fragment evaluation error" means, or where I might look for solutions? I sometimes (but not always) get lots of these errors (without changing my code):
[error] ! Fragment evaluation error
[error] ThrowableException: Could not initialize class code.model.Post$ (FutureTask.java:138)
[error] code.model.PostSpec$$anonfun$1$$anonfun$apply$1.apply$mcZ$sp(PostSpec.scala:68)
[error] code.model.PostSpec$$anonfun$1$$anonfun$apply$1.apply(PostSpec.scala:51)
[error] code.model.PostSpec$$anonfun$1$$anonfun$apply$1.apply(PostSpec.scala:51)
Line 68 of PostSpec is the first line in the (specs2) test that references the Post model companion object:
val test4 = Post.fixJValue(toextract4).extract[Selection]
I'm using Scala 2.9.0-1.
Also: I have no idea whether it matters, but Post is a net.liftweb.mongodb.record.MongoRecord class companion object:
object Post extends Post with MongoMetaRecord[Post] { ... }
In a specs2 specification,
Fragments
are pieces of the specification. AFragment
can be aText
, anExample
, aStep
.Some fragments, like
Example
andStep
are meant to be executed and are supposed to catch Exceptions so that they can be marked as failures. But they won't catchError
s (exceptAssertionError
s). So if an Example throws anOutOfMemoryError
, this will be reported as a Fragment evaluation error.Other fragments, like
Text
fragments are not supposed to throw exceptions when being evaluated. If they do, you will get the sameFragment evaluation error
message.Without seeing the full specification it's hard for me to say what's happening there but I suspect that you had a non-Exception type thrown in the body of an
Example
. But I have more questions than answers for now:test4
declared? Inside the specification body? Inside aContext
case class?