public class Helpers extends java.lang.Object implements Http.Status, Http.HeaderNames
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT
Default Timeout (milliseconds) for fake requests issued by these Helpers.
|
static java.lang.String |
DELETE |
static java.lang.Class<? extends org.openqa.selenium.WebDriver> |
FIREFOX |
static java.lang.String |
GET |
static java.lang.String |
HEAD |
static java.lang.Class<? extends org.openqa.selenium.WebDriver> |
HTMLUNIT |
static java.lang.String |
POST |
static java.lang.String |
PUT |
ACCEPTED, BAD_GATEWAY, BAD_REQUEST, CONFLICT, CONTINUE, CREATED, EXPECTATION_FAILED, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, GONE, HTTP_VERSION_NOT_SUPPORTED, INTERNAL_SERVER_ERROR, LENGTH_REQUIRED, METHOD_NOT_ALLOWED, MOVED_PERMANENTLY, MULTIPLE_CHOICES, NO_CONTENT, NON_AUTHORITATIVE_INFORMATION, NOT_ACCEPTABLE, NOT_FOUND, NOT_IMPLEMENTED, NOT_MODIFIED, OK, PARTIAL_CONTENT, PAYMENT_REQUIRED, PRECONDITION_FAILED, PROXY_AUTHENTICATION_REQUIRED, REQUEST_ENTITY_TOO_LARGE, REQUEST_TIMEOUT, REQUEST_URI_TOO_LONG, REQUESTED_RANGE_NOT_SATISFIABLE, RESET_CONTENT, SEE_OTHER, SERVICE_UNAVAILABLE, SWITCHING_PROTOCOLS, TEMPORARY_REDIRECT, UNAUTHORIZED, UNSUPPORTED_MEDIA_TYPE, USE_PROXY
ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_RANGES, ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS, ACCESS_CONTROL_MAX_AGE, ACCESS_CONTROL_REQUEST_HEADERS, ACCESS_CONTROL_REQUEST_METHOD, AGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONNECTION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_RANGE, CONTENT_TRANSFER_ENCODING, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPECT, EXPIRES, FROM, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_RANGE, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LOCATION, MAX_FORWARDS, ORIGIN, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, RANGE, REFERER, RETRY_AFTER, SERVER, SET_COOKIE, SET_COOKIE2, TE, TRAILER, TRANSFER_ENCODING, UPGRADE, USER_AGENT, VARY, VIA, WARNING, WWW_AUTHENTICATE
Constructor and Description |
---|
Helpers() |
Modifier and Type | Method and Description |
---|---|
static Result |
callAction(HandlerRef actionReference)
Call an action method while decorating it with the right @With interceptors.
|
static Result |
callAction(HandlerRef actionReference,
FakeRequest fakeRequest)
Call an action method while decorating it with the right @With interceptors.
|
static Result |
callAction(HandlerRef actionReference,
FakeRequest fakeRequest,
long timeout) |
static Result |
callAction(HandlerRef actionReference,
long timeout) |
static java.lang.String |
charset(Result result)
Extracts the Charset of this Result value.
|
static java.lang.String |
charset(Result result,
long timeout)
Deprecated.
|
static byte[] |
contentAsBytes(play.twirl.api.Content content)
Extracts the content as bytes.
|
static byte[] |
contentAsBytes(Result result)
Extracts the content as bytes.
|
static byte[] |
contentAsBytes(Result result,
long timeout) |
static java.lang.String |
contentAsString(play.twirl.api.Content content)
Extracts the content as String.
|
static java.lang.String |
contentAsString(Result result)
Extracts the content as String.
|
static java.lang.String |
contentAsString(Result result,
long timeout) |
static java.lang.String |
contentType(play.twirl.api.Content content)
Extracts the Content-Type of this Content value.
|
static java.lang.String |
contentType(Result result)
Extracts the Content-Type of this Result value.
|
static java.lang.String |
contentType(Result result,
long timeout)
Deprecated.
|
static Http.Cookie |
cookie(java.lang.String name,
Result result)
Extracts a Cookie value from this Result value
|
static Http.Cookie |
cookie(java.lang.String name,
Result result,
long timeout)
Deprecated.
|
static Http.Cookies |
cookies(Result result)
Extracts the Cookies (an iterator) from this result value.
|
static Http.Cookies |
cookies(Result result,
long timeout)
Deprecated.
|
static FakeApplication |
fakeApplication()
Build a new fake application.
|
static FakeApplication |
fakeApplication(GlobalSettings global)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
GlobalSettings global)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugin)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugin,
GlobalSettings global)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugins,
java.util.List<java.lang.String> withoutPlugins)
Build a new fake application.
|
static FakeApplication |
fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration,
java.util.List<java.lang.String> additionalPlugins,
java.util.List<java.lang.String> withoutPlugins,
GlobalSettings global)
Build a new fake application.
|
static GlobalSettings |
fakeGlobal()
A fake Global
|
static FakeRequest |
fakeRequest()
Build a new GET / fake request.
|
static FakeRequest |
fakeRequest(Call call)
Build a new fake request corresponding to a given route call
|
static FakeRequest |
fakeRequest(java.lang.String method,
java.lang.String uri)
Build a new fake request.
|
static Http.Flash |
flash(Result result)
Extracts the Flash values of this Result value.
|
static Http.Flash |
flash(Result result,
long timeout)
Deprecated.
|
static java.lang.String |
header(java.lang.String header,
Result result)
Extracts an Header value of this Result value.
|
static java.lang.String |
header(java.lang.String header,
Result result,
long timeout)
Deprecated.
|
static java.util.Map<java.lang.String,java.lang.String> |
headers(Result result)
Extracts all Headers of this Result value.
|
static java.util.Map<java.lang.String,java.lang.String> |
headers(Result result,
long timeout)
Deprecated.
|
static java.util.Map<java.lang.String,java.lang.String> |
inMemoryDatabase()
Constructs a in-memory (h2) database configuration to add to a FakeApplication.
|
static java.util.Map<java.lang.String,java.lang.String> |
inMemoryDatabase(java.lang.String name)
Constructs a in-memory (h2) database configuration to add to a FakeApplication.
|
static java.util.Map<java.lang.String,java.lang.String> |
inMemoryDatabase(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> options)
Constructs a in-memory (h2) database configuration to add to a FakeApplication.
|
static java.lang.String |
redirectLocation(Result result)
Extracts the Location header of this Result value if this Result is a Redirect.
|
static java.lang.String |
redirectLocation(Result result,
long timeout)
Deprecated.
|
static Result |
route(Application app,
FakeRequest fakeRequest) |
static Result |
route(Application app,
FakeRequest fakeRequest,
byte[] body) |
static Result |
route(Application app,
FakeRequest fakeRequest,
byte[] body,
long timeout) |
static Result |
route(Application app,
FakeRequest fakeRequest,
long timeout) |
static Result |
route(FakeRequest fakeRequest) |
static Result |
route(FakeRequest fakeRequest,
byte[] body) |
static Result |
route(FakeRequest fakeRequest,
byte[] body,
long timeout) |
static Result |
route(FakeRequest fakeRequest,
long timeout) |
static Result |
routeAndCall(java.lang.Class<? extends play.core.Router.Routes> router,
FakeRequest fakeRequest)
Deprecated.
|
static Result |
routeAndCall(java.lang.Class<? extends play.core.Router.Routes> router,
FakeRequest fakeRequest,
long timeout) |
static Result |
routeAndCall(FakeRequest fakeRequest)
Deprecated.
|
static Result |
routeAndCall(FakeRequest fakeRequest,
long timeout) |
static void |
running(FakeApplication fakeApplication,
java.lang.Runnable block)
Executes a block of code in a running application.
|
static void |
running(TestServer server,
java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver,
F.Callback<TestBrowser> block)
Executes a block of code in a running server, with a test browser.
|
static void |
running(TestServer server,
java.lang.Runnable block)
Executes a block of code in a running server.
|
static void |
running(TestServer server,
org.openqa.selenium.WebDriver webDriver,
F.Callback<TestBrowser> block)
Executes a block of code in a running server, with a test browser.
|
static Http.Session |
session(Result result)
Extracts the Session of this Result value.
|
static Http.Session |
session(Result result,
long timeout)
Deprecated.
|
static void |
start(FakeApplication fakeApplication)
Starts a new application.
|
static void |
start(TestServer server)
Starts a Test server.
|
static int |
status(Result result)
Extracts the Status code of this Result value.
|
static int |
status(Result result,
long timeout)
Deprecated.
|
static void |
stop(FakeApplication fakeApplication)
Stops an application.
|
static void |
stop(TestServer server)
Stops a Test server.
|
static TestBrowser |
testBrowser()
Creates a Test Browser.
|
static TestBrowser |
testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver,
int port)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(int port)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(org.openqa.selenium.WebDriver of)
Creates a Test Browser.
|
static TestBrowser |
testBrowser(org.openqa.selenium.WebDriver of,
int port)
Creates a Test Browser.
|
static TestServer |
testServer(int port)
Creates a new Test server.
|
static TestServer |
testServer(int port,
FakeApplication app)
Creates a new Test server.
|
public static java.lang.String GET
public static java.lang.String POST
public static java.lang.String PUT
public static java.lang.String DELETE
public static java.lang.String HEAD
public static java.lang.Class<? extends org.openqa.selenium.WebDriver> HTMLUNIT
public static java.lang.Class<? extends org.openqa.selenium.WebDriver> FIREFOX
public static final long DEFAULT_TIMEOUT
public static Result callAction(HandlerRef actionReference)
public static Result callAction(HandlerRef actionReference, long timeout)
public static Result callAction(HandlerRef actionReference, FakeRequest fakeRequest)
public static Result callAction(HandlerRef actionReference, FakeRequest fakeRequest, long timeout)
public static FakeRequest fakeRequest()
public static FakeRequest fakeRequest(java.lang.String method, java.lang.String uri)
public static FakeRequest fakeRequest(Call call)
public static FakeApplication fakeApplication()
public static FakeApplication fakeApplication(GlobalSettings global)
public static GlobalSettings fakeGlobal()
public static java.util.Map<java.lang.String,java.lang.String> inMemoryDatabase()
public static java.util.Map<java.lang.String,java.lang.String> inMemoryDatabase(java.lang.String name)
public static java.util.Map<java.lang.String,java.lang.String> inMemoryDatabase(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> options)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, GlobalSettings global)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugin)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugin, GlobalSettings global)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugins, java.util.List<java.lang.String> withoutPlugins)
public static FakeApplication fakeApplication(java.util.Map<java.lang.String,? extends java.lang.Object> additionalConfiguration, java.util.List<java.lang.String> additionalPlugins, java.util.List<java.lang.String> withoutPlugins, GlobalSettings global)
public static int status(Result result)
@Deprecated public static int status(Result result, long timeout)
public static java.lang.String redirectLocation(Result result)
@Deprecated public static java.lang.String redirectLocation(Result result, long timeout)
public static Http.Flash flash(Result result)
@Deprecated public static Http.Flash flash(Result result, long timeout)
public static Http.Session session(Result result)
@Deprecated public static Http.Session session(Result result, long timeout)
public static Http.Cookie cookie(java.lang.String name, Result result)
@Deprecated public static Http.Cookie cookie(java.lang.String name, Result result, long timeout)
public static Http.Cookies cookies(Result result)
@Deprecated public static Http.Cookies cookies(Result result, long timeout)
public static java.lang.String header(java.lang.String header, Result result)
@Deprecated public static java.lang.String header(java.lang.String header, Result result, long timeout)
public static java.util.Map<java.lang.String,java.lang.String> headers(Result result)
@Deprecated public static java.util.Map<java.lang.String,java.lang.String> headers(Result result, long timeout)
public static java.lang.String contentType(play.twirl.api.Content content)
public static java.lang.String contentType(Result result)
@Deprecated public static java.lang.String contentType(Result result, long timeout)
public static java.lang.String charset(Result result)
@Deprecated public static java.lang.String charset(Result result, long timeout)
public static byte[] contentAsBytes(Result result)
public static byte[] contentAsBytes(Result result, long timeout)
public static byte[] contentAsBytes(play.twirl.api.Content content)
public static java.lang.String contentAsString(play.twirl.api.Content content)
public static java.lang.String contentAsString(Result result)
public static java.lang.String contentAsString(Result result, long timeout)
public static Result routeAndCall(FakeRequest fakeRequest)
instead
public static Result routeAndCall(FakeRequest fakeRequest, long timeout)
public static Result routeAndCall(java.lang.Class<? extends play.core.Router.Routes> router, FakeRequest fakeRequest)
instead
public static Result routeAndCall(java.lang.Class<? extends play.core.Router.Routes> router, FakeRequest fakeRequest, long timeout)
public static Result route(FakeRequest fakeRequest)
public static Result route(FakeRequest fakeRequest, long timeout)
public static Result route(Application app, FakeRequest fakeRequest)
public static Result route(Application app, FakeRequest fakeRequest, long timeout)
public static Result route(Application app, FakeRequest fakeRequest, byte[] body)
public static Result route(Application app, FakeRequest fakeRequest, byte[] body, long timeout)
public static Result route(FakeRequest fakeRequest, byte[] body)
public static Result route(FakeRequest fakeRequest, byte[] body, long timeout)
public static void start(FakeApplication fakeApplication)
public static void stop(FakeApplication fakeApplication)
public static void running(FakeApplication fakeApplication, java.lang.Runnable block)
public static TestServer testServer(int port)
public static TestServer testServer(int port, FakeApplication app)
public static void start(TestServer server)
public static void stop(TestServer server)
public static void running(TestServer server, java.lang.Runnable block)
public static void running(TestServer server, java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver, F.Callback<TestBrowser> block)
public static void running(TestServer server, org.openqa.selenium.WebDriver webDriver, F.Callback<TestBrowser> block)
public static TestBrowser testBrowser()
public static TestBrowser testBrowser(int port)
public static TestBrowser testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver)
public static TestBrowser testBrowser(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriver, int port)
public static TestBrowser testBrowser(org.openqa.selenium.WebDriver of, int port)
public static TestBrowser testBrowser(org.openqa.selenium.WebDriver of)