Can you try

S.initIfUninitted(liftSession) {

   do your code here
}

?
... but you'd still need to create a dumb LiftSession


Br's,
Marius


On Mar 11, 8:40 pm, "Joachim A." <[email protected]> wrote:
> Hi,
> I have a unit test which call a method which uses the locale method S.?
> (String). It throws a nullpointer, though.
>
> Did I forget to setup things somewhere? Or can't I use S.? without a running
> request?
> The call to S.? works fine in a running web application.
>
> Thanks a lot,
> Joachim
>
> The beginning of the backtrace is:
>
> java.lang.NullPointerException
>         at net.liftweb.http.S$.$qmark$bang(S.scala:288)
>         at net.liftweb.http.S$.$qmark(S.scala:263)
>         at net.liftweb.http.S$.$qmark(S.scala:277)
>         at
> com.ansorgit.frontend.SubscriptionMgr$.subscribeToNewsletter(SubscriptionMgr.scala:65)
>         at
> com.ansorgit.frontend.SubscriptionMgrTest$$anonfun$testAlreadySubscribed$1.apply(SubscriptionMgrTest.scala:37)
>         at
> com.ansorgit.frontend.SubscriptionMgrTest$$anonfun$testAlreadySubscribed$1.apply(SubscriptionMgrTest.scala:33)
>         at
> net.liftweb.mapper.DB$$anon$1.net$liftweb$mapper$DB$$anon$$doWith(DB.scala:117)
>         at
> net.liftweb.mapper.DB$$anon$1$$anonfun$net$liftweb$mapper$DB$$anon$$doWith$1.apply(DB.scala:118)
>         at
> net.liftweb.mapper.DB$$anon$1$$anonfun$net$liftweb$mapper$DB$$anon$$doWith$1.apply(DB.scala:118)
>         at net.liftweb.mapper.DB$.use(DB.scala:305)
>         at
> net.liftweb.mapper.DB$$anon$1.net$liftweb$mapper$DB$$anon$$doWith(DB.scala:118)
>         at net.liftweb.mapper.DB$$anon$1.apply(DB.scala:124)
>         at com.ansorgit.BaseDBTest.runInDb(BaseTest.scala:44)
>         at
> com.ansorgit.frontend.SubscriptionMgrTest.testAlreadySubscribed(SubscriptionMgrTest.scala:33)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to