【发布时间】:2014-07-16 01:43:30
【问题描述】:
testOnly play.api.weibo.StatusesShowBatchSpec
[error] Could not create an instance of play.api.weibo.StatusesShowBatchSpec
[error] caused by java.lang.Exception: Could not instantiate class play.api.weibo.StatusesShowBatchSpec: null
[error] org.specs2.reflect.Classes$class.tryToCreateObjectEither(Classes.scala:93)
[error] org.specs2.reflect.Classes$.tryToCreateObjectEither(Classes.scala:211)
[error] org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationEither$2.apply(BaseSpecification.scala:119)
[error] org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationEither$2.apply(BaseSpecification.scala:119)
...
规格
package play.api.weibo
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
class StatusesShowBatchSpec extends ApiSpec {
"'statuses show batch' api" should {
"read statuses" in {
val api = StatusesShowBatch(
accessToken = testAdvancedToken,
ids = "3677163356078857")
val res = awaitApi(api)
res.statuses must have size (1)
}
} }
在此处查看完整代码https://github.com/jilen/play-weibo/tree/spec2_error
【问题讨论】:
-
我收到匹配错误:`scala.MatchError: Left(play.api.weibo.WeiboApiError: Weibo api error: source paramter(appkey) is missing, code: 10006: request: / 2/statuses/show_batch.json)(属于 scala.util.Left 类)`。你确定你还没有修复它吗?
-
谢谢,我已经切换到scalatest,然后发现问题,似乎是spec2的异常吃