public class WebTesterAssertions extends Object
Constructor and Description |
---|
WebTesterAssertions() |
Modifier and Type | Method and Description |
---|---|
static void |
assertAtLoginPage(String reason) |
static void |
assertAtLoginPage(String reason,
net.sourceforge.jwebunit.junit.WebTester tester) |
static void |
assertDoesNotContain(String unexpectedSubstring,
String actual) |
static void |
assertImageIsPresentWithSrcUrlThatContains(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 |
assertLinkNotPresentWithAttribute(String name) |
static void |
assertLinkNotPresentWithHrefContaining(String urlSubstring) |
static void |
assertLinkPresentWithAttribute(String name) |
static void |
assertLinkPresentWithAttribute(String name,
String value) |
static void |
assertLinkPresentWithHref(String url) |
static void |
assertLinkPresentWithHrefContaining(String urlSubstring) |
static void |
assertLinkPresentWithTextAndHref(String text,
String href) |
static void |
assertPageAndSpaceTitle(String pageTitle,
String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix
(usually SITE_TITLE_SUFFIX).
|
static void |
assertPageAndSpaceTitle(String reason,
String pageTitle,
String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix
(usually SITE_TITLE_SUFFIX).
|
static void |
assertPageTitle(String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. |
static void |
assertPageTitle(String reason,
String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. |
static void |
assertPageTitleAnyOf(List<String> pageTitles)
Asserts that the title is found within the specified collection of titles
plus the site suffix (usually SITE_TITLE_SUFFIX).
|
static void |
assertPageTitleEquals(String reason,
net.sourceforge.jwebunit.junit.WebTester webTester,
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,
String pageTitle)
Asserts that the title equals the passed pageTitle plus the site suffix (usually SITE_TITLE_SUFFIX)
e.g. |
static void |
assertServerResponseContains(String string) |
static void |
assertStartsWith(String expectedPrefix,
String actual) |
static void |
assertStatusCode(int expectedStatus) |
static void |
assertStatusCode(int expectedStatus,
String failureMessage)
Assert the status code and should the assertion fail then include the supplied failure message.
|
static void |
assertTextNotPresentInPageSource(String text) |
static void |
assertTextPresentInPageSource(String text)
Asserts that the given text is in the page source.
|
static void |
assertTextsPresentInOrder(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(String[] expected,
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(String reason,
net.sourceforge.jwebunit.junit.WebTester webTester,
String pageTitle,
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,
String pageTitle,
String spaceTitle)
Asserts that the title equals the passed pageTitle plus separator plus spaceTitle plus site suffix
(usually SITE_TITLE_SUFFIX).
|
public static void assertPageTitleEquals(net.sourceforge.jwebunit.junit.WebTester webTester, String pageTitle)
webTester
- The WebTesterpageTitle
- The title displayed before the first separatorpublic static void assertPageTitleEquals(String reason, net.sourceforge.jwebunit.junit.WebTester webTester, String pageTitle)
reason
- additional information about any assertion failurewebTester
- The WebTesterpageTitle
- The title displayed before the first separatorpublic static void assertTitleEquals(net.sourceforge.jwebunit.junit.WebTester webTester, String pageTitle, String spaceTitle)
webTester
- The WebTesterpageTitle
- The title displayed before the first separatorspaceTitle
- The title displayed for the tested spacepublic static void assertTitleEquals(String reason, net.sourceforge.jwebunit.junit.WebTester webTester, String pageTitle, String spaceTitle)
reason
- additional information about any assertion failurewebTester
- The WebTesterpageTitle
- The title displayed before the first separatorspaceTitle
- The title displayed for the tested spacepublic static void assertPageTitle(String pageTitle)
pageTitle
- The title displayed before the first separatorpublic static void assertPageTitleAnyOf(List<String> pageTitles)
pageTitles
- The list of possible titles displayed before the first separatorpublic static void assertPageTitle(String reason, String pageTitle)
reason
- additional information about any assertion failurepageTitle
- The title displayed before the first separatorpublic static void assertPageAndSpaceTitle(String pageTitle, String spaceTitle)
pageTitle
- The title displayed before the first separatorspaceTitle
- The title displayed for the tested spacepublic static void assertPageAndSpaceTitle(String reason, String pageTitle, String spaceTitle)
reason
- additional information about any assertion failurepageTitle
- The title displayed before the first separatorspaceTitle
- The title displayed for the tested spacepublic static void assertTextsPresentInOrder(String... texts)
texts
- an array of strings expected to appear in the responsepublic static void assertTextsPresentInOrder(String[] expected, String[] unexpected)
expected
- an array of strings expected to appear in the responseunexpected
- an array of string unexpected to appear in the responsepublic static void assertTextPresentInPageSource(String text)
text
- the text to look forpublic static void assertTextNotPresentInPageSource(String text)
public static void assertLinkPresentWithHref(String url)
public static void assertLinkPresentWithAttribute(String name)
public static void assertLinkNotPresentWithAttribute(String name)
public static void assertLinkPresentWithAttribute(String name, String value)
public static void assertLinkPresentWithHrefContaining(String urlSubstring)
public static void assertLinkNotPresentWithHrefContaining(String urlSubstring)
public static void assertLinkPresentWithTextAndHref(String text, String href)
public static void assertStatusCode(int expectedStatus)
public static void assertStatusCode(int expectedStatus, String failureMessage)
expectedStatus
- the status to assert forfailureMessage
- the message to include should the assertion failpublic static void assertServerResponseContains(String string)
public static void assertDoesNotContain(String unexpectedSubstring, String actual)
public static void assertIsLoggedInAs(User user)
public static void assertAtLoginPage(String reason) throws URISyntaxException
URISyntaxException
public static void assertAtLoginPage(String reason, net.sourceforge.jwebunit.junit.WebTester tester) throws URISyntaxException
URISyntaxException
public static void assertImageIsPresentWithSrcUrlThatContains(String imageName)
JWebUnit.assertImagePresent(String, String)
that asserts the image name with
a contains check rather than equals.imageName
- The path to the image (i.e. the src attribute value)Copyright © 2003–2021 Atlassian. All rights reserved.