object Helpers extends PlayRunners with HeaderNames with Status with MimeTypes with HttpProtocol with DefaultAwaitTimeout with ResultExtractors with Writeables with EssentialActionCaller with RouteInvokers with FutureAwaits with StubControllerComponentsFactory
- Source
- Helpers.scala
- Alphabetic
- By Inheritance
- Helpers
- StubControllerComponentsFactory
- StubMessagesFactory
- StubBodyParserFactory
- StubPlayBodyParsersFactory
- FutureAwaits
- RouteInvokers
- EssentialActionCaller
- Writeables
- ResultExtractors
- DefaultAwaitTimeout
- HttpProtocol
- MimeTypes
- Status
- HeaderNames
- PlayRunners
- HttpVerbs
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
NegativeTimeout(t: Timeout) extends Product with Serializable
How long we should wait for something that we expect *not* to happen, e.g.
How long we should wait for something that we expect *not* to happen, e.g. waiting to make sure that a channel is *not* closed by some concurrent process.
NegativeTimeout is a separate type to a normal Timeout because we'll want to set it to a lower value. This is because in normal usage we'll need to wait for the full length of time to show that nothing has happened in that time. If the value is too high then we'll spend a lot of time waiting during normal usage. If it is too low, however, we may miss events that occur after the timeout has finished. This is a necessary tradeoff.
Where possible, tests should avoid using a NegativeTimeout. Tests will often know exactly when an event should occur. In this case they can perform a check for the event immediately rather than using using NegativeTimeout.
- Definition Classes
- DefaultAwaitTimeout
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
ACCEPT: String
- Definition Classes
- HeaderNames
-
val
ACCEPTED: Int
- Definition Classes
- Status
-
val
ACCEPT_CHARSET: String
- Definition Classes
- HeaderNames
-
val
ACCEPT_ENCODING: String
- Definition Classes
- HeaderNames
-
val
ACCEPT_LANGUAGE: String
- Definition Classes
- HeaderNames
-
val
ACCEPT_RANGES: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_ALLOW_CREDENTIALS: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_ALLOW_HEADERS: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_ALLOW_METHODS: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_ALLOW_ORIGIN: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_EXPOSE_HEADERS: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_MAX_AGE: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_REQUEST_HEADERS: String
- Definition Classes
- HeaderNames
-
val
ACCESS_CONTROL_REQUEST_METHOD: String
- Definition Classes
- HeaderNames
-
val
AGE: String
- Definition Classes
- HeaderNames
-
val
ALLOW: String
- Definition Classes
- HeaderNames
-
val
AUTHORIZATION: String
- Definition Classes
- HeaderNames
-
val
BAD_GATEWAY: Int
- Definition Classes
- Status
-
val
BAD_REQUEST: Int
- Definition Classes
- Status
-
val
BINARY: String
Content-Type of binary data.
Content-Type of binary data.
- Definition Classes
- MimeTypes
-
val
CACHE_CONTROL: String
- Definition Classes
- HeaderNames
-
val
CACHE_MANIFEST: String
Content-Type of application cache.
Content-Type of application cache.
- Definition Classes
- MimeTypes
-
val
CHUNKED: String
- Definition Classes
- HttpProtocol
-
val
CONFLICT: Int
- Definition Classes
- Status
-
val
CONNECTION: String
- Definition Classes
- HeaderNames
-
val
CONTENT_DISPOSITION: String
- Definition Classes
- HeaderNames
-
val
CONTENT_ENCODING: String
- Definition Classes
- HeaderNames
-
val
CONTENT_LANGUAGE: String
- Definition Classes
- HeaderNames
-
val
CONTENT_LENGTH: String
- Definition Classes
- HeaderNames
-
val
CONTENT_LOCATION: String
- Definition Classes
- HeaderNames
-
val
CONTENT_MD5: String
- Definition Classes
- HeaderNames
-
val
CONTENT_RANGE: String
- Definition Classes
- HeaderNames
-
val
CONTENT_SECURITY_POLICY: String
- Definition Classes
- HeaderNames
-
val
CONTENT_SECURITY_POLICY_REPORT_ONLY: String
- Definition Classes
- HeaderNames
-
val
CONTENT_TRANSFER_ENCODING: String
- Definition Classes
- HeaderNames
-
val
CONTENT_TYPE: String
- Definition Classes
- HeaderNames
-
val
CONTINUE: Int
- Definition Classes
- Status
-
val
COOKIE: String
- Definition Classes
- HeaderNames
-
val
CREATED: Int
- Definition Classes
- Status
-
val
CSS: String
Content-Type of css.
Content-Type of css.
- Definition Classes
- MimeTypes
-
val
DATE: String
- Definition Classes
- HeaderNames
-
val
DELETE: String
- Definition Classes
- HttpVerbs
-
val
ETAG: String
- Definition Classes
- HeaderNames
-
val
EVENT_STREAM: String
Content-Type of server sent events.
Content-Type of server sent events.
- Definition Classes
- MimeTypes
-
val
EXPECT: String
- Definition Classes
- HeaderNames
-
val
EXPECTATION_FAILED: Int
- Definition Classes
- Status
-
val
EXPIRES: String
- Definition Classes
- HeaderNames
-
val
FAILED_DEPENDENCY: Int
- Definition Classes
- Status
-
val
FIREFOX: Class[FirefoxDriver]
- Definition Classes
- PlayRunners
-
val
FORBIDDEN: Int
- Definition Classes
- Status
-
val
FORM: String
Content-Type of form-urlencoded.
Content-Type of form-urlencoded.
- Definition Classes
- MimeTypes
-
val
FORWARDED: String
- Definition Classes
- HeaderNames
-
val
FOUND: Int
- Definition Classes
- Status
-
val
FROM: String
- Definition Classes
- HeaderNames
-
val
GATEWAY_TIMEOUT: Int
- Definition Classes
- Status
-
val
GET: String
- Definition Classes
- HttpVerbs
-
val
GONE: Int
- Definition Classes
- Status
-
val
HEAD: String
- Definition Classes
- HttpVerbs
-
val
HOST: String
- Definition Classes
- HeaderNames
-
val
HTML: String
Content-Type of html.
Content-Type of html.
- Definition Classes
- MimeTypes
-
val
HTMLUNIT: Class[HtmlUnitDriver]
- Definition Classes
- PlayRunners
-
val
HTTP_1_0: String
- Definition Classes
- HttpProtocol
-
val
HTTP_1_1: String
- Definition Classes
- HttpProtocol
-
val
HTTP_VERSION_NOT_SUPPORTED: Int
- Definition Classes
- Status
-
val
IF_MATCH: String
- Definition Classes
- HeaderNames
-
val
IF_MODIFIED_SINCE: String
- Definition Classes
- HeaderNames
-
val
IF_NONE_MATCH: String
- Definition Classes
- HeaderNames
-
val
IF_RANGE: String
- Definition Classes
- HeaderNames
-
val
IF_UNMODIFIED_SINCE: String
- Definition Classes
- HeaderNames
-
val
IM_A_TEAPOT: Int
- Definition Classes
- Status
-
val
INSUFFICIENT_STORAGE: Int
- Definition Classes
- Status
-
val
INTERNAL_SERVER_ERROR: Int
- Definition Classes
- Status
-
val
JAVASCRIPT: String
Content-Type of javascript.
Content-Type of javascript.
- Definition Classes
- MimeTypes
-
val
JSON: String
Content-Type of json.
Content-Type of json.
- Definition Classes
- MimeTypes
-
val
LAST_MODIFIED: String
- Definition Classes
- HeaderNames
-
val
LENGTH_REQUIRED: Int
- Definition Classes
- Status
-
val
LINK: String
- Definition Classes
- HeaderNames
-
val
LOCATION: String
- Definition Classes
- HeaderNames
-
val
LOCKED: Int
- Definition Classes
- Status
-
val
MAX_FORWARDS: String
- Definition Classes
- HeaderNames
-
val
METHOD_NOT_ALLOWED: Int
- Definition Classes
- Status
-
val
MOVED_PERMANENTLY: Int
- Definition Classes
- Status
-
val
MULTIPLE_CHOICES: Int
- Definition Classes
- Status
-
val
MULTI_STATUS: Int
- Definition Classes
- Status
-
val
NETWORK_AUTHENTICATION_REQUIRED: Int
- Definition Classes
- Status
-
val
NON_AUTHORITATIVE_INFORMATION: Int
- Definition Classes
- Status
-
val
NOT_ACCEPTABLE: Int
- Definition Classes
- Status
-
val
NOT_FOUND: Int
- Definition Classes
- Status
-
val
NOT_IMPLEMENTED: Int
- Definition Classes
- Status
-
val
NOT_MODIFIED: Int
- Definition Classes
- Status
-
val
NO_CONTENT: Int
- Definition Classes
- Status
-
val
OK: Int
- Definition Classes
- Status
-
val
OPTIONS: String
- Definition Classes
- HttpVerbs
-
val
ORIGIN: String
- Definition Classes
- HeaderNames
-
val
PARTIAL_CONTENT: Int
- Definition Classes
- Status
-
val
PATCH: String
- Definition Classes
- HttpVerbs
-
val
PAYMENT_REQUIRED: Int
- Definition Classes
- Status
-
val
PERMANENT_REDIRECT: Int
- Definition Classes
- Status
-
val
POST: String
- Definition Classes
- HttpVerbs
-
val
PRAGMA: String
- Definition Classes
- HeaderNames
-
val
PRECONDITION_FAILED: Int
- Definition Classes
- Status
-
val
PRECONDITION_REQUIRED: Int
- Definition Classes
- Status
-
val
PROXY_AUTHENTICATE: String
- Definition Classes
- HeaderNames
-
val
PROXY_AUTHENTICATION_REQUIRED: Int
- Definition Classes
- Status
-
val
PROXY_AUTHORIZATION: String
- Definition Classes
- HeaderNames
-
val
PUT: String
- Definition Classes
- HttpVerbs
-
val
RANGE: String
- Definition Classes
- HeaderNames
-
val
REFERER: String
- Definition Classes
- HeaderNames
-
val
REFERRER_POLICY: String
- Definition Classes
- HeaderNames
-
val
REQUESTED_RANGE_NOT_SATISFIABLE: Int
- Definition Classes
- Status
-
val
REQUEST_ENTITY_TOO_LARGE: Int
- Definition Classes
- Status
-
val
REQUEST_HEADER_FIELDS_TOO_LARGE: Int
- Definition Classes
- Status
-
val
REQUEST_TIMEOUT: Int
- Definition Classes
- Status
-
val
REQUEST_URI_TOO_LONG: Int
- Definition Classes
- Status
-
val
RESET_CONTENT: Int
- Definition Classes
- Status
-
val
RETRY_AFTER: String
- Definition Classes
- HeaderNames
-
val
SEE_OTHER: Int
- Definition Classes
- Status
-
val
SERVER: String
- Definition Classes
- HeaderNames
-
val
SERVICE_UNAVAILABLE: Int
- Definition Classes
- Status
-
val
SET_COOKIE: String
- Definition Classes
- HeaderNames
-
val
SET_COOKIE2: String
- Definition Classes
- HeaderNames
-
val
STRICT_TRANSPORT_SECURITY: String
- Definition Classes
- HeaderNames
-
val
SWITCHING_PROTOCOLS: Int
- Definition Classes
- Status
-
val
TE: String
- Definition Classes
- HeaderNames
-
val
TEMPORARY_REDIRECT: Int
- Definition Classes
- Status
-
val
TEXT: String
Content-Type of text.
Content-Type of text.
- Definition Classes
- MimeTypes
-
val
TOO_MANY_REQUESTS: Int
- Definition Classes
- Status
-
val
TRAILER: String
- Definition Classes
- HeaderNames
-
val
TRANSFER_ENCODING: String
- Definition Classes
- HeaderNames
-
val
UNAUTHORIZED: Int
- Definition Classes
- Status
-
val
UNPROCESSABLE_ENTITY: Int
- Definition Classes
- Status
-
val
UNSUPPORTED_MEDIA_TYPE: Int
- Definition Classes
- Status
-
val
UPGRADE: String
- Definition Classes
- HeaderNames
-
val
UPGRADE_REQUIRED: Int
- Definition Classes
- Status
-
val
USER_AGENT: String
- Definition Classes
- HeaderNames
-
val
USE_PROXY: Int
- Definition Classes
- Status
-
val
VARY: String
- Definition Classes
- HeaderNames
-
val
VIA: String
- Definition Classes
- HeaderNames
-
val
WARNING: String
- Definition Classes
- HeaderNames
-
val
WWW_AUTHENTICATE: String
- Definition Classes
- HeaderNames
-
val
XHTML: String
Content-Type of xml.
Content-Type of xml.
- Definition Classes
- MimeTypes
-
val
XML: String
Content-Type of xml.
Content-Type of xml.
- Definition Classes
- MimeTypes
-
val
X_CONTENT_SECURITY_POLICY_NONCE_HEADER: String
- Definition Classes
- HeaderNames
-
val
X_CONTENT_TYPE_OPTIONS: String
- Definition Classes
- HeaderNames
-
val
X_FORWARDED_FOR: String
- Definition Classes
- HeaderNames
-
val
X_FORWARDED_HOST: String
- Definition Classes
- HeaderNames
-
val
X_FORWARDED_PORT: String
- Definition Classes
- HeaderNames
-
val
X_FORWARDED_PROTO: String
- Definition Classes
- HeaderNames
-
val
X_FRAME_OPTIONS: String
- Definition Classes
- HeaderNames
-
val
X_PERMITTED_CROSS_DOMAIN_POLICIES: String
- Definition Classes
- HeaderNames
-
val
X_REQUESTED_WITH: String
- Definition Classes
- HeaderNames
-
val
X_XSS_PROTECTION: String
- Definition Classes
- HeaderNames
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
await[T](future: Future[T], timeout: Long, unit: TimeUnit): T
Block until a Promise is redeemed with the specified timeout.
Block until a Promise is redeemed with the specified timeout.
- Definition Classes
- FutureAwaits
-
def
await[T](future: Future[T])(implicit timeout: Timeout): T
Block until a Promise is redeemed.
Block until a Promise is redeemed.
- Definition Classes
- FutureAwaits
-
lazy val
baseApplicationBuilder: GuiceApplicationBuilder
The base builder used in the running method.
The base builder used in the running method.
- Definition Classes
- PlayRunners
-
def
call[T](action: EssentialAction, rh: RequestHeader, body: T)(implicit w: Writeable[T], mat: Materializer): Future[Result]
Execute an play.api.mvc.EssentialAction.
Execute an play.api.mvc.EssentialAction.
The body is serialised using the implicit writable, so that the action body parser can deserialize it.
- Definition Classes
- EssentialActionCaller
-
def
call[T](action: EssentialAction, req: Request[T])(implicit w: Writeable[T], mat: Materializer): Future[Result]
Execute an play.api.mvc.EssentialAction.
Execute an play.api.mvc.EssentialAction.
The body is serialised using the implicit writable, so that the action body parser can deserialize it.
- Definition Classes
- EssentialActionCaller
-
def
charset(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Option[String]
Extracts the Charset of this Result value.
Extracts the Charset of this Result value.
- Definition Classes
- ResultExtractors
-
def
charset(of: Future[Result])(implicit timeout: Timeout): Option[String]
Extracts the Charset of this Result value.
Extracts the Charset of this Result value.
- Definition Classes
- ResultExtractors
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
contentAsBytes(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): ByteString
Extracts the content as bytes.
Extracts the content as bytes.
- Definition Classes
- ResultExtractors
-
def
contentAsBytes(of: Future[Result])(implicit timeout: Timeout, mat: Materializer = NoMaterializer): ByteString
Extracts the content as bytes.
Extracts the content as bytes.
- Definition Classes
- ResultExtractors
-
def
contentAsBytes(of: Content)(implicit timeout: Timeout): Array[Byte]
Extracts the content as bytes.
Extracts the content as bytes.
- Definition Classes
- ResultExtractors
-
def
contentAsJson(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): JsValue
Extracts the content as Json.
Extracts the content as Json.
- Definition Classes
- ResultExtractors
-
def
contentAsJson(of: Future[Result])(implicit timeout: Timeout, mat: Materializer = NoMaterializer): JsValue
Extracts the content as Json.
Extracts the content as Json.
- Definition Classes
- ResultExtractors
-
def
contentAsJson(of: Content)(implicit timeout: Timeout): JsValue
Extracts the content as Json.
Extracts the content as Json.
- Definition Classes
- ResultExtractors
-
def
contentAsString(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): String
Extracts the content as String.
Extracts the content as String.
- Definition Classes
- ResultExtractors
-
def
contentAsString(of: Future[Result])(implicit timeout: Timeout, mat: Materializer = NoMaterializer): String
Extracts the content as String.
Extracts the content as String.
- Definition Classes
- ResultExtractors
-
def
contentAsString(of: Content)(implicit timeout: Timeout): String
Extracts the content as String.
Extracts the content as String.
- Definition Classes
- ResultExtractors
-
def
contentType(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Option[String]
Extracts the Content-Type of this Result value.
Extracts the Content-Type of this Result value.
- Definition Classes
- ResultExtractors
-
def
contentType(of: Future[Result])(implicit timeout: Timeout): Option[String]
Extracts the Content-Type of this Result value.
Extracts the Content-Type of this Result value.
- Definition Classes
- ResultExtractors
-
def
contentType(of: Content)(implicit timeout: Timeout): String
Extracts the Content-Type of this Content value.
Extracts the Content-Type of this Content value.
- Definition Classes
- ResultExtractors
-
def
cookies(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Cookies
Extracts the Cookies set by this Result value.
Extracts the Cookies set by this Result value.
- Definition Classes
- ResultExtractors
-
def
cookies(of: Future[Result])(implicit timeout: Timeout): Cookies
Gets the Cookies associated with this Result value.
Gets the Cookies associated with this Result value. Note that this only extracts the "new" cookies added to this result (e.g. through withCookies), not including the Session or Flash. The final set of cookies may be different because the Play server automatically adds those cookies and merges the headers.
- Definition Classes
- ResultExtractors
-
implicit
def
defaultAwaitTimeout: Timeout
The default await timeout.
The default await timeout. Override this to change it.
- Definition Classes
- DefaultAwaitTimeout
-
implicit
val
defaultNegativeTimeout: NegativeTimeout
- Definition Classes
- DefaultAwaitTimeout
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flash(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Flash
Extracts the Flash values set by this Result value.
Extracts the Flash values set by this Result value.
- Definition Classes
- ResultExtractors
-
def
flash(of: Future[Result])(implicit timeout: Timeout): Flash
Extracts the Flash values set by this Result value.
Extracts the Flash values set by this Result value.
- Definition Classes
- ResultExtractors
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
header(header: String, of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Option[String]
Extracts an Header value of this Result value.
Extracts an Header value of this Result value.
- Definition Classes
- ResultExtractors
-
def
header(header: String, of: Future[Result])(implicit timeout: Timeout): Option[String]
Extracts an Header value of this Result value.
Extracts an Header value of this Result value.
- Definition Classes
- ResultExtractors
-
def
headers(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Map[String, String]
Extracts all Headers of this Result value.
Extracts all Headers of this Result value.
- Definition Classes
- ResultExtractors
-
def
headers(of: Future[Result])(implicit timeout: Timeout): Map[String, String]
Extracts all Headers of this Result value.
Extracts all Headers of this Result value.
- Definition Classes
- ResultExtractors
-
def
inMemoryDatabase(name: String = "default", options: Map[String, String] = Map.empty[String, String]): Map[String, String]
Constructs a in-memory (h2) database configuration to add to an Application.
Constructs a in-memory (h2) database configuration to add to an Application.
- Definition Classes
- PlayRunners
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
jRoute[T](app: Application, r: RequestHeader, body: RequestBody): Option[Future[Result]]
- Definition Classes
- RouteInvokers
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
redirectLocation(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Option[String]
Extracts the Location header of this Result value if this Result is a Redirect.
Extracts the Location header of this Result value if this Result is a Redirect.
- Definition Classes
- ResultExtractors
-
def
redirectLocation(of: Future[Result])(implicit timeout: Timeout): Option[String]
Extracts the Location header of this Result value if this Result is a Redirect.
Extracts the Location header of this Result value if this Result is a Redirect.
- Definition Classes
- ResultExtractors
-
def
route[T](app: Application, req: Request[T])(implicit w: Writeable[T]): Option[Future[Result]]
Use the HttpRequestHandler to determine the Action to call for this request and execute it.
Use the HttpRequestHandler to determine the Action to call for this request and execute it.
The body is serialised using the implicit writable, so that the action body parser can deserialize it.
- Definition Classes
- RouteInvokers
-
def
route[T](app: Application, rh: RequestHeader, body: T)(implicit w: Writeable[T]): Option[Future[Result]]
Use the HttpRequestHandler to determine the Action to call for this request and execute it.
Use the HttpRequestHandler to determine the Action to call for this request and execute it.
The body is serialised using the implicit writable, so that the action body parser can deserialize it.
- Definition Classes
- RouteInvokers
-
def
running[T](testServer: TestServer, webDriver: WebDriver)(block: (TestBrowser) ⇒ T): T
Executes a block of code in a running server, with a test browser.
Executes a block of code in a running server, with a test browser.
- Definition Classes
- PlayRunners
-
def
running[T, WEBDRIVER <: WebDriver](testServer: TestServer, webDriver: Class[WEBDRIVER])(block: (TestBrowser) ⇒ T): T
Executes a block of code in a running server, with a test browser.
Executes a block of code in a running server, with a test browser.
- Definition Classes
- PlayRunners
-
def
running[T](testServer: TestServer)(block: ⇒ T): T
Executes a block of code in a running server.
Executes a block of code in a running server.
- Definition Classes
- PlayRunners
-
def
running[T](builder: (GuiceApplicationBuilder) ⇒ GuiceApplicationBuilder)(block: (Application) ⇒ T): T
- Definition Classes
- PlayRunners
-
def
running[T](app: Application)(block: ⇒ T): T
Executes a block of code in a running application.
Executes a block of code in a running application.
- Definition Classes
- PlayRunners
-
def
running[T]()(block: (Application) ⇒ T): T
- Definition Classes
- PlayRunners
-
def
session(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Session
Extracts the Session set by this Result value.
Extracts the Session set by this Result value.
- Definition Classes
- ResultExtractors
-
def
session(of: Future[Result])(implicit timeout: Timeout): Session
Extracts the Session values set by this Result value.
Extracts the Session values set by this Result value.
- Definition Classes
- ResultExtractors
-
def
shouldRunSequentially(app: Application): Boolean
Tests using servers share a test server port so we default to true.
Tests using servers share a test server port so we default to true.
- Attributes
- protected
- Definition Classes
- PlayRunners
-
def
status(of: Accumulator[ByteString, Result])(implicit timeout: Timeout, mat: Materializer): Int
Extracts the Status code of this Result value.
Extracts the Status code of this Result value.
- Definition Classes
- ResultExtractors
-
def
status(of: Future[Result])(implicit timeout: Timeout): Int
Extracts the Status code of this Result value.
Extracts the Status code of this Result value.
- Definition Classes
- ResultExtractors
-
def
stubBodyParser[T](content: T = AnyContentAsEmpty): BodyParser[T]
Stub method that returns the content immediately.
Stub method that returns the content immediately. Useful for unit testing.
val stubParser = bodyParser(AnyContent("hello"))
- content
the content to return, AnyContentAsEmpty by default
- returns
a BodyParser for type T that returns Accumulator.done(Right(content))
- Definition Classes
- StubBodyParserFactory
-
def
stubControllerComponents(bodyParser: BodyParser[AnyContent] = stubBodyParser(AnyContentAsEmpty), playBodyParsers: PlayBodyParsers = stubPlayBodyParsers(NoMaterializer), messagesApi: MessagesApi = stubMessagesApi(), langs: Langs = stubLangs(), fileMimeTypes: FileMimeTypes = ..., executionContext: ExecutionContext = ExecutionContext.global): ControllerComponents
Create a minimal controller components, useful for unit testing.
Create a minimal controller components, useful for unit testing.
In most cases, you'll want the standard defaults:
val controller = new MyController(stubControllerComponents())
A custom body parser can be used with bodyParser() to provide a request body to the controller:
val cc = stubControllerComponents(bodyParser(AnyContent("request body text")))
- bodyParser
the body parser used to parse any content, stubBodyParser(AnyContentAsEmpty) by default.
- playBodyParsers
the playbodyparsers, defaults to stubPlayBodyParsers(NoMaterializer)
- langs
the langs instance for messaging, new DefaultLangs() by default.
- fileMimeTypes
the mime type associated with file extensions, new DefaultFileMimeTypes(FileMimeTypesConfiguration() by default.
- executionContext
an execution context, defaults to ExecutionContext.global
- returns
a fully configured ControllerComponents instance.
- Definition Classes
- StubControllerComponentsFactory
-
def
stubLangs(availables: Seq[Lang] = Seq(Lang.defaultLang)): Langs
- availables
default as Seq(Lang.defaultLang).
- returns
a stub Langs
- Definition Classes
- StubMessagesFactory
-
def
stubMessages(messagesApi: MessagesApi = stubMessagesApi(), requestHeader: RequestHeader = FakeRequest()): Messages
Stub method that returns a play.api.i18n.Messages instance.
Stub method that returns a play.api.i18n.Messages instance.
- messagesApi
the messagesApi to use, uses stubMessagesApi by default.
- requestHeader
the request to use, FakeRequest by default.
- returns
the Messages instance
- Definition Classes
- StubMessagesFactory
-
def
stubMessagesApi(messages: Map[String, Map[String, String]] = Map.empty, langs: Langs = stubLangs(), langCookieName: String = "PLAY_LANG", langCookieSecure: Boolean = false, langCookieHttpOnly: Boolean = false, langCookieSameSite: Option[SameSite] = None, httpConfiguration: HttpConfiguration = HttpConfiguration()): MessagesApi
Returns a stub DefaultMessagesApi with default values and an empty map.
Returns a stub DefaultMessagesApi with default values and an empty map.
- messages
map of languages to map of messages, empty by default.
- langs
stubLangs() by default
- langCookieName
"PLAY_LANG" by default
- langCookieSecure
false by default
- langCookieHttpOnly
false by default
- langCookieSameSite
None by default
- httpConfiguration
configuration, HttpConfiguration() by default.
- returns
the messagesApi with minimal configuration.
- Definition Classes
- StubMessagesFactory
-
def
stubMessagesControllerComponents(): MessagesControllerComponents
- Definition Classes
- StubControllerComponentsFactory
-
def
stubMessagesRequest(messagesApi: MessagesApi = stubMessagesApi(), request: Request[AnyContentAsEmpty.type] = FakeRequest()): MessagesRequest[AnyContentAsEmpty.type]
Stub method that returns a play.api.mvc.MessagesRequest instance.
Stub method that returns a play.api.mvc.MessagesRequest instance.
- messagesApi
the messagesApi to use, uses stubMessagesApi by default.
- request
the request to use, FakeRequest by default.
- returns
the Messages instance
- Definition Classes
- StubMessagesFactory
-
def
stubPlayBodyParsers(implicit mat: Materializer): PlayBodyParsers
Stub method for unit testing, using NoTemporaryFileCreator.
Stub method for unit testing, using NoTemporaryFileCreator.
- mat
the input materializer.
- returns
a minimal PlayBodyParsers for unit testing.
- Definition Classes
- StubPlayBodyParsersFactory
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
lazy val
testServerPort: Int
The port to use for a test server.
The port to use for a test server. Defaults to 19001. May be configured using the system property testserver.port
- Definition Classes
- PlayRunners
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
implicit
def
writeableOf_AnyContentAsEmpty(implicit code: Codec): Writeable[AnyContentAsEmpty.type]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsFormUrlEncoded(implicit code: Codec): Writeable[AnyContentAsFormUrlEncoded]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsJson: Writeable[AnyContentAsJson]
- Definition Classes
- Writeables
-
def
writeableOf_AnyContentAsJson(codec: Codec, contentType: Option[String] = None): Writeable[AnyContentAsJson]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsMultipartForm(contentType: Option[String])(implicit codec: Codec): Writeable[AnyContentAsMultipartFormData]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsMultipartForm(implicit codec: Codec): Writeable[AnyContentAsMultipartFormData]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsRaw: Writeable[AnyContentAsRaw]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsText(implicit code: Codec): Writeable[AnyContentAsText]
- Definition Classes
- Writeables
-
implicit
def
writeableOf_AnyContentAsXml(implicit codec: Codec): Writeable[AnyContentAsXml]
- Definition Classes
- Writeables