title: How to write tests for a Play Framework Filter?
body: <p>I've written a Filter for my Play application: </p>
  
  <pre><code>object MyFilter {
    def apply() = new MyFilter()
  }
  
  class MyFilter extends EssentialFilter {
    def apply(next: EssentialAction) = new EssentialAction {
      def apply(requestHeader: RequestHeader) = {
  
        requestHeader.cookies.get("myCookie") match {
          case Some(cookie) =&gt; {
            requestHeader.session + ("importantValue", cookie.value)
            next(requestHeader)
          }
          case None =&gt; {
            val importantValue = ... // retrieve the value from somewhere
            requestHeader.session + ("importantValue", importantValue)
            next(requestHeader).map(_.withCookies(Cookie("importantValue", value)))
        }
  
      }
    }
  }
  </code></pre>
  
  <p>There're a lot of examples in the Play documentation about how to write test, but I've no idea how to unit test MyFilter. Can someone help me a little?</p>
  
  <p>Thanks</p>
  
  <p>Torben</p>