I'm trying to build some tests around a method that reads some data from the session.
I tried extending FakeRequest
and overriding the session
value, but I get an error on compilation saying that session
has to be a val
when overriden, which won't work.
How can I modify a FakeRequest()
to add values to the session?
There is a pull request about this functionality
See https://github.com/playframework/Play20/pull/103
I used some examples from the pull request to build this in without using an updated version of play:
Create cookie:
Create and execute fakeRequest:
Then to get stuff out I created the following:
Given the existing style of test methods:
I made:
Which you call:
Have to say this is not tested in anger. But see if it helps.