Object

net.liftweb.mockweb

MockWeb

Related Doc: package mockweb

Permalink

object MockWeb

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
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MockWeb
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

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

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

    Permalink

    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.

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

    Permalink

    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.

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

    Permalink

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

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

    Permalink

    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

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

    Permalink

    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

  21. def toString(): String

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

    Permalink
  23. var useLiftRulesGlobally: Boolean

    Permalink

    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.

  24. final def wait(): Unit

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

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

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

    Permalink

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

    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

Ungrouped