Package rife.test

Class MockLink

java.lang.Object
rife.test.MockLink

public class MockLink extends Object
Corresponds to a link in an HTML document after it has been parsed with ParsedHtml.parse(rife.test.MockResponse).
Since:
1.0
  • 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

      public MockRequest getRequest()
      Creates a new MockRequest that contains the parameters this link.
      Returns:
      the created MockRequest
      Since:
      1.0
    • follow

      public MockResponse follow()
      Follow 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.0
      See Also:
    • getParameterNames

      public Collection<String> getParameterNames()
      Retrieves all the parameter names of this link.
      Returns:
      a Collection of the parameter names
      Since:
      1.0
      See Also:
    • 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.0
      See Also:
    • 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.0
      See Also:
    • 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.0
      See Also:
    • 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