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'sclass
attribute.Retrieves the JSoup element that this link corresponds to.getHref()
Retrieves the content of this link'shref
attribute.getId()
Retrieves the content of this link'sid
attribute.getName()
Retrieves the content of this link'sname
attribute.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 newMockRequest
that contains the parameters this link.Retrieves the content of this link'starget
attribute.getText()
Retrieves the text that this links surrounds.getTitle()
Retrieves the content of this link'stitle
attribute.boolean
hasParameter
(String name) Checks whether a named parameter is present in this link.
-
Method Details
-
getElement
Retrieves the JSoup element that this link corresponds to.- Returns:
- the corresponding JSoup element
- Since:
- 1.0
-
getRequest
Creates a newMockRequest
that 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
Map
of 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
Collection
of 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:
true
if the parameter is present; orfalse
otherwise- 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
null
if 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
null
if no such parameter could be found - Since:
- 1.0
- See Also:
-
getId
Retrieves the content of this link'sid
attribute.- Returns:
- the content of the
id
attribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getClassName
Retrieves the content of this link'sclass
attribute.- Returns:
- the content of the
class
attribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getTitle
Retrieves the content of this link'stitle
attribute.- Returns:
- the content of the
title
attribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getHref
Retrieves the content of this link'shref
attribute.- Returns:
- the content of the
href
attribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getTarget
Retrieves the content of this link'starget
attribute.- Returns:
- the content of the
target
attribute; ornull if no such attribute could be found
- Since:
- 1.0
-
getName
Retrieves the content of this link'sname
attribute.- Returns:
- the content of the
name
attribute; 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
-