I'll point out also that in tests, given that this doesn't seem like you're
using a server as a functional test, that you can rebind the scope as you
wish in a test module:
  bindScope(RequestScoped.class, new YourSimpleTestScope());

This is useful if you really don't care about the scoping, but harmful if
your tests require some of its behavior.

-Fred

On Fri, Jan 21, 2011 at 1:29 PM, Sam Berlin <[email protected]> wrote:

> The error message is saying that no Scope implementation is bound to the
> @RequestScope scope, not that a RequestScope is inactive.  You can fix this
> by installing ServletModule.
>
> As for creating a new "request scope" for each test.. check out the new
> ServletScopes.scopeRequest & continueRequest methods.  That may help.
>
> sam
>
>
> On Thu, Jan 20, 2011 at 1:58 PM, cowwoc <[email protected]> wrote:
>
>> Hi,
>>
>> I'd like to write a unit test for code that runs under guice-servlet.
>> Unfortunately when I try running the tests I get:
>>
>> "No scope is bound to com.google.inject.servlet.RequestScoped."
>>
>> Is there an easy way for me to trigger a new "request" for each test
>> method?
>>
>> Thanks,
>> Gili
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-guice%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" 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/google-guice?hl=en.

Reply via email to