public class RequestSpecHelper extends SpecHelper
SpecHelper.DynamicBuilder, SpecHelper.ModuleBuilder
Constructor and Description |
---|
RequestSpecHelper() |
Modifier and Type | Method and Description |
---|---|
protected Map |
assigns()
Provides values assigned by controller during execution.
|
void |
atStart00() |
protected byte[] |
bytesContent()
Provides content generated by controller as bytes.
|
protected String |
contentType()
Provides content type set on response by controller
|
protected Cookie |
cookie(String name)
Returns a cookie from last response by name,
null if not found. |
protected String |
cookieValue(String name)
Convenience method, returns cookie value.
|
int |
count(String cssQuery)
Parses controller response and counts elements that are found by a CSS query.
|
protected Cookie[] |
getCookies()
Returns all cookies from last response.
|
protected String |
header(String headerName)
Returns header set by controller or filter.
|
protected List<String> |
headerNames()
Returns all headers set by controller or filter.
|
protected Map<String,String> |
headers()
Returns all headers set by controller or filter.
|
protected String |
layout()
Provides layout set after executing an action of a controller.
|
protected boolean |
redirected()
Returns true after execution of an action that sent a redirect.
|
protected String |
redirectValue()
Returns a redirect value if one was produced by a controller or filter, null if not.
|
protected String |
responseContent()
Provides content generated by controller after controller execution - if views were integrated.
|
protected int |
statusCode()
Provides status code set on response by controller
|
protected String |
template() |
protected String |
text(String cssQuery)
Parses controller response content and selects content of HTML element using CSS selectors.
Example: |
protected Object |
val(String name)
Returns a single value assigned by controller.
|
protected <T> T |
val(String name,
Class<T> type)
Returns a single value assigned by controller.
|
protected boolean |
valBoolean(String name)
boolean value assigned by controller.
|
protected double |
valDouble(String name)
double value assigned by controller.
|
protected float |
valFloat(String name)
float value assigned by controller.
|
protected int |
valInteger(String name)
int value assigned by controller.
|
protected long |
valLong(String name)
long value assigned by controller.
|
protected Map |
vals()
Synonym of
assigns() . |
protected String |
valString(String name)
String value assigned by controller.
|
afterEnd, atStart, createInjector, flash, flash, flashExists, injector, registerTag, session, session, session, sessionBoolean, sessionDouble, sessionFloat, sessionHas, sessionInteger, sessionLong, sessionObject, sessionString, setInjector, setTemplateLocation
@BeforeEach public final void atStart00()
protected int statusCode()
protected String contentType()
protected String responseContent()
protected byte[] bytesContent()
protected String layout()
protected String template()
protected Map assigns()
protected Map vals()
assigns()
.protected Object val(String name)
name
- name of a value assigned by controller.protected <T> T val(String name, Class<T> type)
name
- name of a value assigned by controller.type
- type to be returned.protected String header(String headerName)
headerName
- name of headerprotected Map<String,String> headers()
protected List<String> headerNames()
protected String valString(String name)
name
- name of a value assigned by controller.protected int valInteger(String name)
name
- name of a value assigned by controller.protected long valLong(String name)
name
- name of a value assigned by controller.protected double valDouble(String name)
name
- name of a value assigned by controller.protected float valFloat(String name)
name
- name of a value assigned by controller.protected boolean valBoolean(String name)
name
- name of a value assigned by controller.protected boolean redirected()
protected String redirectValue()
protected Cookie[] getCookies()
protected Cookie cookie(String name)
null
if not found.name
- name of cookie.null
if not found.protected String cookieValue(String name)
name
- name of cookie.protected String text(String cssQuery)
request().get("index"); a(find("div[class='greeting']").shouldEqual("Hello!");
cssQuery
- CSS query. Implementation is based on JSoup.public int count(String cssQuery)
request().get("index"); a(count("div[class='main']").shouldEqual(1);
cssQuery
- CSS query. Implementation is based on JSoup.Copyright © 2019 JavaLite. All rights reserved.