4

私は次のような設定をしています:

class PriceAwareSpec extends Specification  {

 sequential

 running(FakeApplication()) {

 val price = "CHF 50.00"
 val priceAsHtml: Html = Html(price)

 val context: Context = ContextAccessUtil.getContext
 val stateAccess = ServiceFactoryUtil.getService(context, classOf[StateAccess])

 "price aware template" should {

   "per default" in {

    stateAccess.store(StateKeys.HIDE_NETTO_KEY, java.lang.Boolean.FALSE)

     "show netto" in {
       val html = views.html.price.priceAware(priceAsHtml, true)(request)
       contentAsString(html) must contain(price)
     }

     "show brutto" in {
       val html = views.html.price.priceAware(priceAsHtml, false)(request)
       contentAsString(html) must contain(price)
     }
   }
 }
}

への呼びかけで

ContextAccessUtil.getContext

プレイキャッシュへのアクセスがあります

play.cache.Cache.get("foo")

現在のアプリケーションから情報を取得しようとします (=FakeApplication() ?)

これにより、NullPointerException が発生します。

[error]       NullPointerException: null (Cache.scala:-1)
[error] play.api.cache.Cache$.get(Cache.scala:57)
[error] play.api.cache.Cache.get(Cache.scala)
[error] play.cache.Cache.get(Cache.java:16)

これは、アプリケーションが存在しないことを示しています....?!

セットアップに何か問題がありますか?

4

1 に答える 1