private val msg4: String = """{"code":0,"data":null}""" //OK
private val msg5: String = """{"code":0,"data":[{"test": null}]}""" //NPE
private val msg6: String = """{"code":0,"data":[{"test": "aaa"}]}""" //OK
private val msg7: String = """{"code":0,"data":[{"test": "aaa", "t2": null}]}""" //NPE
private val msg8: String = """{"code":0,"data":{"test": "aaa", "t2": null}}""" //NPE
def testEquals = {
try {
msg(4~8) must /("code" -> 0.0) //msg(4~8) means msg4, msg5, ..,msg8
} catch {
case e:NullPointerException => {
e.printStackTrace()
throw e
}
}
As comment that in the end of msg string shown, Some string will occure NPE when check root element that "code" equals 0(as code shown).
The json string is well format, and test code is match the specs2 reference, so maybe is this a bug?
I am newbie to scala, so to trace the code is too slow, can anybody help me to find the solution? Thanks.