net.liftweb.mockweb

MockWeb

object MockWeb extends AnyRef

The MockWeb object contains various methods to simplify unit testing in Lift outside of the full-blown testkit stack.

There is partial support for configuration defined in the LiftRules object. This includes:

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. MockWeb
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  18. def testReq[T](request: HttpServletRequest)(f: (Req) ⇒ T): T

    Executes a given function against a new Req constructed from the given HttpServletRequest.

    Executes a given function against a new Req constructed from the given HttpServletRequest. If useLiftRules is set to true, then LiftRules.early, LiftRules.statelessRewrite, and LiftRules.statelessTest rules are applied.

  19. def testReq[T](url: String, contextPath: String = "")(f: (Req) ⇒ T): T

    Executes a given function against a new Req constructed from the given url/path String and contextPath.

    Executes a given function against a new Req constructed from the given url/path String and contextPath. See MockHttpServletRequest.processUrl for details on the url String format, and see testReq(HttpServletRequest) for more details on how the Req is processed.

  20. def testS[T](request: HttpServletRequest)(testFunc: ⇒ T): T

    Sets up S based on the provided request and a new session.

  21. def testS[T](request: HttpServletRequest, session: Box[LiftSession])(testFunc: ⇒ T): T

    Sets up S based on the provided request and session.

    Sets up S based on the provided request and session. You can use this method if you want to do special setup on the request outside of what is handled by the MockHttpServletRequest constructor, or if you want to use a different mock impl.

    You can provide your own session if you want to simulate sharing a session across multiple requests. See testS(String,String,Box[LiftSession]) for an example of this use.

    Note that if useLiftRules is set to true, then rules like LiftRules.early, LiftRules.statelessTest, etc, will be applied.

    request

    The request to be used for this test

    session

    The LiftSession to use for this request. Passing Empty will force creation of a new session

    testFunc

    The function to be executed in the scope of a new S

  22. def testS[T](url: String, session: Box[LiftSession] = Empty, contextPath: String = "")(testFunc: ⇒ T): T

    Sets up S based on the provided url, contextPath and session.

    Sets up S based on the provided url, contextPath and session. You can provide your own session if you want to simulate sharing a session across multiple requests. For example:

    object testVar extends SessionVar[String]("Empty")

    val testSession = testS("http://foo.com/test") { testVar("Foo!") S.session // returns the current session }

    // A second test testS("http://foo.com/test2", session = testSession) { testVar.is must_== "Foo!" }

    url

    The url to use for this request. Can either be a full URL, or just the path and queryString. See MockHttpServletRequest.processUrl for more details

    session

    The LiftSession to use for this request. If you don't provide one a new one will be created for you

    contextPath

    The servlet context path for this request

    testFunc

    The function to be executed in the scope of a new S

  23. def toString(): String

    Definition Classes
    AnyRef → Any
  24. object useLiftRules extends ThreadGlobal[Boolean]

  25. var useLiftRulesGlobally: Boolean

    Setting this var to true will force all tests to use LiftRules.

    Setting this var to true will force all tests to use LiftRules. See useLiftRules for more granular control.

  26. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  27. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  28. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  29. def withSnippet[T](name: String, attrs: MetaData = Null)(f: ⇒ T): T

    This is a utility method to allow you to set the S.

    This is a utility method to allow you to set the S.currentSnippet method for testing.

    name

    The snippet name to be tested. For example, <lift:MyWidget.foo/> has a name of MyWidget.foo. You can retrieve this via S.currentSnippet or S.invokedAs

    attrs

    The list of snippet tag attributes. Defaults to Null. See S.attrs for more details

    f

    The function to execute in the context of the emulated snippet

Inherited from AnyRef

Inherited from Any