com.uwyn.rife.test
Class MockLink

java.lang.Object
  extended by com.uwyn.rife.test.MockLink

public class MockLink
extends Object

Corresponds to a link in a HTML document after it has been parsed with ParsedHtml.parse(com.uwyn.rife.test.MockResponse).

Since:
1.1
Version:
$Revision: 3634 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)

Method Summary
 MockResponse click()
          Click this link with its current parameters and returns the response.
 String getClassName()
          Retrieves the content of this link's class attribute.
 String getHref()
          Retrieves the content of this link's href attribute.
 String getId()
          Retrieves the content of this link's id attribute.
 String getName()
          Retrieves the content of this link's name attribute.
 Node getNode()
          Retrieves the DOM XML node that this link corresponds to.
 Collection<String> getParameterNames()
          Retrieves all the parameter names of this link.
 Map<String,String[]> getParameters()
          Retrieves all the parameters of this link.
 String 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.
 MockRequest getRequest()
          Creates a new MockRequest that contains the parameters this link.
 String getTarget()
          Retrieves the content of this link's target attribute.
 String getText()
          Retrieves the text that this links surrounds.
 String getTitle()
          Retrieves the content of this link's title attribute.
 boolean hasParameter(String name)
          Checks whether a named parameter is present in this link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNode

public Node getNode()
Retrieves the DOM XML node that this link corresponds to.

Returns:
the corresponding DOM XML node
Since:
1.0

getRequest

public MockRequest getRequest()
Creates a new MockRequest that contains the parameters this link.

Returns:
the created MockRequest
Since:
1.0

click

public MockResponse click()
Click this link with its current parameters and returns the response.

Returns:
the resulting MockResponse
Since:
1.0

getParameters

public Map<String,String[]> 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.1
See Also:
getParameterNames(), hasParameter(java.lang.String), getParameterValue(java.lang.String), getParameterValues(java.lang.String)

getParameterNames

public Collection<String> getParameterNames()
Retrieves all the parameter names of this link.

Returns:
a Collection of the parameter names
Since:
1.1
See Also:
getParameters(), hasParameter(java.lang.String), getParameterValue(java.lang.String), getParameterValues(java.lang.String)

hasParameter

public boolean hasParameter(String name)
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; or

false otherwise

Since:
1.1
See Also:
getParameters(), getParameterNames(), getParameterValue(java.lang.String), getParameterValues(java.lang.String)

getParameterValue

public String getParameterValue(String name)
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.1
See Also:
getParameters(), getParameterNames(), hasParameter(java.lang.String), getParameterValues(java.lang.String)

getParameterValues

public String[] getParameterValues(String name)
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.1
See Also:
getParameters(), getParameterNames(), hasParameter(java.lang.String), getParameterValue(java.lang.String)

getId

public String getId()
Retrieves the content of this link's id attribute.

Returns:
the content of the id attribute; or

null if no such attribute could be found

Since:
1.0

getClassName

public String getClassName()
Retrieves the content of this link's class attribute.

Returns:
the content of the class attribute; or

null if no such attribute could be found

Since:
1.0

getTitle

public String getTitle()
Retrieves the content of this link's title attribute.

Returns:
the content of the title attribute; or

null if no such attribute could be found

Since:
1.0

getHref

public String getHref()
Retrieves the content of this link's href attribute.

Returns:
the content of the href attribute; or

null if no such attribute could be found

Since:
1.0

getTarget

public String getTarget()
Retrieves the content of this link's target attribute.

Returns:
the content of the target attribute; or

null if no such attribute could be found

Since:
1.0

getName

public String getName()
Retrieves the content of this link's name attribute.

Returns:
the content of the name attribute; or

null if no such attribute could be found

Since:
1.0

getText

public String getText()
Retrieves the text that this links surrounds.

Returns:
the surrounded text
Since:
1.0


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.