public abstract class FunctionalTest extends BaseTest
Modifier and Type | Class and Description |
---|---|
static class |
FunctionalTest._ByteArrayOutputStream |
static class |
FunctionalTest.URL |
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_X_WWW_FORM_URLENCODED |
static String |
MULTIPART_FORM_DATA |
startPlayBeforeTests
Constructor and Description |
---|
FunctionalTest() |
Modifier and Type | Method and Description |
---|---|
static void |
assertCharset(String charset,
Http.Response response)
Verify response charset encoding, as returned by the server in the
Content-Type header.
|
static void |
assertContentEquals(String content,
Http.Response response)
Exact equality assertion on response body
|
static void |
assertContentMatch(String pattern,
Http.Response response)
Asserts response body matched a pattern or contains some text.
|
static void |
assertContentType(String contentType,
Http.Response response)
Verify the response content-type
|
static void |
assertHeaderEquals(String headerName,
String value,
Http.Response response)
Exact equality assertion on a response header value
|
static void |
assertIsNotFound(Http.Response response)
Asserts a 404 (not found) response
|
static void |
assertIsOk(Http.Response response)
Asserts a 2OO Success response
|
static void |
assertStatus(int status,
Http.Response response)
Asserts response status code
|
void |
clearCookies() |
static Http.Response |
DELETE(Http.Request request,
Object url)
Sends a DELETE request to the application under tests.
|
static Http.Response |
DELETE(String url) |
static Http.Response |
GET(Http.Request request,
Object url)
sends a GET request to the application under tests.
|
static Http.Response |
GET(Object url) |
static Http.Response |
GET(Object url,
boolean followRedirect)
sends a GET request to the application under tests.
|
static String |
getContent(Http.Response response)
obtains the response body as a string
|
static Http.Response |
makeRequest(Http.Request request) |
static void |
makeRequest(Http.Request request,
Http.Response response) |
static Http.Request |
newRequest() |
static Http.Response |
newResponse() |
static Http.Response |
POST(Http.Request request,
Object url) |
static Http.Response |
POST(Http.Request request,
Object url,
Map<String,String> parameters,
Map<String,File> files) |
static Http.Response |
POST(Http.Request request,
Object url,
String contenttype,
InputStream body)
Sends a POST request to the application under tests.
|
static Http.Response |
POST(Http.Request request,
Object url,
String contenttype,
String body) |
static Http.Response |
POST(Object url) |
static Http.Response |
POST(Object url,
Map<String,String> parameters) |
static Http.Response |
POST(Object url,
Map<String,String> parameters,
Map<String,File> files)
Sends a POST request to the application under tests as a multipart form.
|
static Http.Response |
POST(Object url,
String contenttype,
InputStream body) |
static Http.Response |
POST(Object url,
String contenttype,
String body) |
static Http.Response |
PUT(Http.Request request,
Object url,
String contenttype,
String body)
Sends a PUT request to the application under tests.
|
static Http.Response |
PUT(Object url,
String contenttype,
String body) |
static Object |
renderArgs(String name) |
protected static FunctionalTest.URL |
reverse() |
void |
sleep(int seconds) |
clearJPASession, pause
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
public static final String APPLICATION_X_WWW_FORM_URLENCODED
public static final String MULTIPART_FORM_DATA
public void clearCookies()
public static Http.Response GET(Object url)
public static Http.Response GET(Object url, boolean followRedirect)
url
- relative url such as "/products/1234"followRedirect
- indicates if request have to follow redirection (status 302)public static Http.Response GET(Http.Request request, Object url)
request
- url
- relative url such as "/products/1234"public static Http.Response POST(Object url)
public static Http.Response POST(Http.Request request, Object url)
public static Http.Response POST(Object url, String contenttype, String body)
public static Http.Response POST(Http.Request request, Object url, String contenttype, String body)
public static Http.Response POST(Object url, String contenttype, InputStream body)
public static Http.Response POST(Http.Request request, Object url, String contenttype, InputStream body)
request
- url
- relative url such as "/products/1234"contenttype
- content-type of the requestbody
- posted datapublic static Http.Response POST(Object url, Map<String,String> parameters, Map<String,File> files)
url
- relative url such as "/products/1234"parameters
- map of parameters to be postedfiles
- map containing files to be uploadedpublic static Http.Response POST(Object url, Map<String,String> parameters)
public static Http.Response POST(Http.Request request, Object url, Map<String,String> parameters, Map<String,File> files)
public static Http.Response PUT(Object url, String contenttype, String body)
public static Http.Response PUT(Http.Request request, Object url, String contenttype, String body)
request
- url
- relative url such as "/products/1234"contenttype
- content-type of the requestbody
- data to sendpublic static Http.Response DELETE(String url)
public static Http.Response DELETE(Http.Request request, Object url)
request
- url
- relative url eg. "/products/1234"public static void makeRequest(Http.Request request, Http.Response response)
public static Http.Response makeRequest(Http.Request request)
public static Http.Response newResponse()
public static Http.Request newRequest()
public static void assertIsOk(Http.Response response)
response
- server responsepublic static void assertIsNotFound(Http.Response response)
response
- server responsepublic static void assertStatus(int status, Http.Response response)
status
- expected HTTP response coderesponse
- server responsepublic static void assertContentEquals(String content, Http.Response response)
content
- expected body contentresponse
- server responsepublic static void assertContentMatch(String pattern, Http.Response response)
pattern
- a regular expression pattern or a regular text, ( which must
be escaped using Pattern.quote)response
- server responsepublic static void assertCharset(String charset, Http.Response response)
charset
- expected charset encoding such as "utf-8" or "iso8859-1".response
- server responsepublic static void assertContentType(String contentType, Http.Response response)
contentType
- expected content-type without any charset extension, such as
"text/html"response
- server responsepublic static void assertHeaderEquals(String headerName, String value, Http.Response response)
headerName
- header to verify. case-insensitivevalue
- expected header valueresponse
- server responsepublic static String getContent(Http.Response response)
response
- server responsepublic void sleep(int seconds)
protected static FunctionalTest.URL reverse()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly