Best practice to test buisiness logic is create a POJO-bean that works with
model or transfer objects (which are assembled from session attributes).
Servlet will delegate all work to a POJO-bean. And then you can easily
unit-test your POJO-bean which contains all business logic.

In a case if you need to test how some service manages HttpSession - you can
create a mock with EasyMock or Mockito and test whether correct attributes
were passed/removed from session.

--
Kind regards,
Ignat Alexeyenko.

On Thu, Nov 11, 2010 at 2:43 PM, decitrig <[email protected]> wrote:

> I have a RemoteServiceServlet that I'd like to test independently from
> my client code, however it needs access to an HttpSession object for a
> great many of the methods. I've thought of a few methods that seem a
> little hackish: I could refactor most of the logic into
> @VisibleForTesting methods that take the session attributes as
> parameters, or I could re-implement the interface in another class and
> delegate to it from the servlet. What are the best practices here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en.

Reply via email to