com.atlassian.confluence.htmlunit
Class WebTesterAssertions

java.lang.Object
  extended by com.atlassian.confluence.htmlunit.WebTesterAssertions

public class WebTesterAssertions
extends java.lang.Object

Assertions that revolve around a WebTester


Constructor Summary
WebTesterAssertions()
           
 
Method Summary
static void assertAtLoginPage(java.lang.String reason)
           
static void assertAtLoginPage(java.lang.String reason, net.sourceforge.jwebunit.junit.WebTester tester)
           
static void assertDoesNotContain(java.lang.String unexpectedSubstring, java.lang.String actual)
           
static void assertImageIsPresentWithSrcUrlThatContains(java.lang.String imageName)
          Provide our own implementation of JWebUnit.assertImagePresent(String, String) that asserts the image name with a contains check rather than equals.
static void assertIsLoggedInAs(User user)
           
static void assertLinkNotPresentWithHrefContaining(java.lang.String urlSubstring)
           
static void assertLinkPresentWithHref(java.lang.String url)
           
static void assertLinkPresentWithHrefContaining(java.lang.String urlSubstring)
           
static void assertLinkPresentWithTextAndHref(java.lang.String text, java.lang.String href)
           
static void assertPageAndSpaceTitle(java.lang.String pageTitle, java.lang.String spaceTitle)
          Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
static void assertPageAndSpaceTitle(java.lang.String reason, java.lang.String pageTitle, java.lang.String spaceTitle)
          Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
static void assertPageTitle(java.lang.String pageTitle)
          Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g.
static void assertPageTitle(java.lang.String reason, java.lang.String pageTitle)
          Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g.
static void assertPageTitleEquals(java.lang.String reason, net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String pageTitle)
          Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g.
static void assertPageTitleEquals(net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String pageTitle)
          Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g.
static void assertServerResponseContains(java.lang.String string)
           
static void assertStartsWith(java.lang.String expectedPrefix, java.lang.String actual)
           
static void assertStatusCode(int expectedStatus)
           
static void assertStatusCode(int expectedStatus, java.lang.String failureMessage)
          Assert the status code and should the assertion fail then include the supplied failure message.
static void assertTextNotPresentInPageSource(java.lang.String text)
           
static void assertTextPresentInPageSource(java.lang.String text)
          Asserts that the given text is in the page source.
static void assertTextsPresentInOrder(java.lang.String... texts)
          Asserts that all the given texts appear in the current response in the order in which they appear in the array.
static void assertTextsPresentInOrder(java.lang.String[] expected, java.lang.String[] unexpected)
          Asserts that all the given expected texts appear in the current response in the order in which they appear in the array, with none of the unexpected Strings occurring in-between.
static void assertTitleEquals(java.lang.String reason, net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String pageTitle, java.lang.String spaceTitle)
          Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
static void assertTitleEquals(net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String pageTitle, java.lang.String spaceTitle)
          Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebTesterAssertions

public WebTesterAssertions()
Method Detail

assertPageTitleEquals

public static void assertPageTitleEquals(net.sourceforge.jwebunit.junit.WebTester webTester,
                                         java.lang.String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. "Dashboard - Confluence"

Parameters:
webTester - The WebTester
pageTitle - The title displayed before the first separator

assertPageTitleEquals

public static void assertPageTitleEquals(java.lang.String reason,
                                         net.sourceforge.jwebunit.junit.WebTester webTester,
                                         java.lang.String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. "Dashboard - Confluence"

Parameters:
reason - additional information about any assertion failure
webTester - The WebTester
pageTitle - The title displayed before the first separator

assertTitleEquals

public static void assertTitleEquals(net.sourceforge.jwebunit.junit.WebTester webTester,
                                     java.lang.String pageTitle,
                                     java.lang.String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
e.g. "Home - Test Space - Confluence"

Parameters:
webTester - The WebTester
pageTitle - The title displayed before the first separator
spaceTitle - The title displayed for the tested space

assertTitleEquals

public static void assertTitleEquals(java.lang.String reason,
                                     net.sourceforge.jwebunit.junit.WebTester webTester,
                                     java.lang.String pageTitle,
                                     java.lang.String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
e.g. "Home - Test Space - Confluence"

Parameters:
reason - additional information about any assertion failure
webTester - The WebTester
pageTitle - The title displayed before the first separator
spaceTitle - The title displayed for the tested space

assertPageTitle

public static void assertPageTitle(java.lang.String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. "Dashboard - Confluence"

Parameters:
pageTitle - The title displayed before the first separator

assertPageTitle

public static void assertPageTitle(java.lang.String reason,
                                   java.lang.String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. "Dashboard - Confluence"

Parameters:
reason - additional information about any assertion failure
pageTitle - The title displayed before the first separator

assertPageAndSpaceTitle

public static void assertPageAndSpaceTitle(java.lang.String pageTitle,
                                           java.lang.String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
e.g. "Home - Test Space - Confluence"

Parameters:
pageTitle - The title displayed before the first separator
spaceTitle - The title displayed for the tested space

assertPageAndSpaceTitle

public static void assertPageAndSpaceTitle(java.lang.String reason,
                                           java.lang.String pageTitle,
                                           java.lang.String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix (usually SITE_TITLE_SUFFIX).
e.g. "Home - Test Space - Confluence"

Parameters:
reason - additional information about any assertion failure
pageTitle - The title displayed before the first separator
spaceTitle - The title displayed for the tested space

assertTextsPresentInOrder

public static void assertTextsPresentInOrder(java.lang.String... texts)
Asserts that all the given texts appear in the current response in the order in which they appear in the array.

Parameters:
texts - an array of strings expected to appear in the response

assertTextsPresentInOrder

public static void assertTextsPresentInOrder(java.lang.String[] expected,
                                             java.lang.String[] unexpected)
Asserts that all the given expected texts appear in the current response in the order in which they appear in the array, with none of the unexpected Strings occurring in-between.

Parameters:
expected - an array of strings expected to appear in the response
unexpected - an array of string unexpected to appear in the response

assertTextPresentInPageSource

public static void assertTextPresentInPageSource(java.lang.String text)
Asserts that the given text is in the page source. Useful for testing non-html responses where assertTextPresent doesn't work.

Parameters:
text - the text to look for

assertTextNotPresentInPageSource

public static void assertTextNotPresentInPageSource(java.lang.String text)

assertLinkPresentWithHref

public static void assertLinkPresentWithHref(java.lang.String url)

assertLinkPresentWithHrefContaining

public static void assertLinkPresentWithHrefContaining(java.lang.String urlSubstring)

assertLinkNotPresentWithHrefContaining

public static void assertLinkNotPresentWithHrefContaining(java.lang.String urlSubstring)

assertLinkPresentWithTextAndHref

public static void assertLinkPresentWithTextAndHref(java.lang.String text,
                                                    java.lang.String href)

assertStatusCode

public static void assertStatusCode(int expectedStatus)

assertStatusCode

public static void assertStatusCode(int expectedStatus,
                                    java.lang.String failureMessage)
Assert the status code and should the assertion fail then include the supplied failure message.

Parameters:
expectedStatus - the status to assert for
failureMessage - the message to include should the assertion fail

assertServerResponseContains

public static void assertServerResponseContains(java.lang.String string)

assertDoesNotContain

public static void assertDoesNotContain(java.lang.String unexpectedSubstring,
                                        java.lang.String actual)

assertStartsWith

public static void assertStartsWith(java.lang.String expectedPrefix,
                                    java.lang.String actual)

assertIsLoggedInAs

public static void assertIsLoggedInAs(User user)

assertAtLoginPage

public static void assertAtLoginPage(java.lang.String reason)
                              throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

assertAtLoginPage

public static void assertAtLoginPage(java.lang.String reason,
                                     net.sourceforge.jwebunit.junit.WebTester tester)
                              throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

assertImageIsPresentWithSrcUrlThatContains

public static void assertImageIsPresentWithSrcUrlThatContains(java.lang.String imageName)
Provide our own implementation of JWebUnit.assertImagePresent(String, String) that asserts the image name with a contains check rather than equals.

Parameters:
imageName - The path to the image (i.e. the src attribute value)


Copyright © 2003-2014 Atlassian. All Rights Reserved.