Class AnchorTester

All Implemented Interfaces:
Clickable<Anchor>

public class AnchorTester extends HtmlContainerTester<Anchor>
  • Constructor Details

    • AnchorTester

      public AnchorTester(Anchor component)
      Wrap given component for testing.
      Parameters:
      component - target component
  • Method Details

    • getHref

      public String getHref()
      Gets the URL that the anchor links to.
      Returns:
      the href value, or "" if no href has been set
    • getPath

      public String getPath()
      Gets the path for the router-link. Returns an empty String if there is no corresponding navigation target.
      Returns:
      a String containing the navigation target path or empty if not present
    • getQueryParameters

      public QueryParameters getQueryParameters()
      Gets the query parameters for the router-link.
      Returns:
      a QueryParameters containing the navigation target's query parameters
    • click

      public void click()
      Click the anchor for navigation if target is a registered route in the application. This is equivalent to calling navigate(). For cases where you need to access the navigated view, use navigate() instead as it returns the target view.
      Throws:
      IllegalStateException - if anchor href is not a String or not a route
    • download

      public void download(OutputStream outputStream)
      Download the stream resource linked by the anchor.
      Parameters:
      outputStream - output stream to write the stream resource to
      Throws:
      IllegalStateException - if the anchor does not link to a stream resource