Package rife.test
Class MockLink
java.lang.Object
rife.test.MockLink
Corresponds to a link in an HTML document after it has been parsed with
ParsedHtml.parse(rife.test.MockResponse).- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionfollow()Follow this link with its current parameters and returns the response.Retrieves the content of this link'sclassattribute.org.jsoup.nodes.ElementRetrieves the JSoup element that this link corresponds to.getHref()Retrieves the content of this link'shrefattribute.getId()Retrieves the content of this link'sidattribute.getName()Retrieves the content of this link'snameattribute.Retrieves all the parameter names of this link.Retrieves all the parameters of this link.getParameterValue(String name) Retrieves the first value of a parameter in this link.String[]getParameterValues(String name) Retrieves the values of a parameter in this link.Creates a newMockRequestthat contains the parameters this link.Retrieves the content of this link'stargetattribute.getText()Retrieves the text that this links surrounds.getTitle()Retrieves the content of this link'stitleattribute.booleanhasParameter(String name) Checks whether a named parameter is present in this link.
-
Method Details
-
getElement
public org.jsoup.nodes.Element getElement()Retrieves the JSoup element that this link corresponds to.- Returns:
- the corresponding JSoup element
- Since:
- 1.0
-
getRequest
Creates a newMockRequestthat contains the parameters this link.- Returns:
- the created
MockRequest - Since:
- 1.0
-
follow
Follow this link with its current parameters and returns the response.- Returns:
- the resulting
MockResponse - Since:
- 1.0
-
getParameters
Retrieves all the parameters of this link.- Returns:
- a
Mapof the parameters with the names as the keys and their value arrays as the values - Since:
- 1.0
- See Also:
-
getParameterNames
Retrieves all the parameter names of this link.- Returns:
- a
Collectionof the parameter names - Since:
- 1.0
- See Also:
-
hasParameter
Checks whether a named parameter is present in this link.- Parameters:
name- the name of the parameter to check- Returns:
trueif the parameter is present; orfalseotherwise- Since:
- 1.0
- See Also:
-
getParameterValue
Retrieves the first value of a parameter in this link.- Parameters:
name- the name of the parameter- Returns:
- the first value of the parameter; or
nullif no such parameter could be found - Since:
- 1.0
- See Also:
-
getParameterValues
Retrieves the values of a parameter in this link.- Parameters:
name- the name of the parameter- Returns:
- the values of the parameter; or
nullif no such parameter could be found - Since:
- 1.0
- See Also:
-
getId
Retrieves the content of this link'sidattribute.- Returns:
- the content of the
idattribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getClassName
Retrieves the content of this link'sclassattribute.- Returns:
- the content of the
classattribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getTitle
Retrieves the content of this link'stitleattribute.- Returns:
- the content of the
titleattribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getHref
Retrieves the content of this link'shrefattribute.- Returns:
- the content of the
hrefattribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getTarget
Retrieves the content of this link'stargetattribute.- Returns:
- the content of the
targetattribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getName
Retrieves the content of this link'snameattribute.- Returns:
- the content of the
nameattribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getText
Retrieves the text that this links surrounds.- Returns:
- the surrounded text
- Since:
- 1.0
-