public class

TextKit

extends Object
java.lang.Object
   ↳ com.atlassian.jira.functest.framework.util.text.TextKit

Class Overview

A class that handles text assertions and searches.

Summary

Public Constructors
TextKit()
Public Methods
static void assertContainsTextSequence(String srcText, String[] expectedTextSequence)
Returns true if the given expectedTextSequence of Strings all occur within the given srcText in the order given.
static String collapseWhitespace(String text)
Collapses repeated white space ( \n\t) in the string into a single space.
static boolean containsCollapseWhiteSpace(String needle, String haystack)
Tests if two strings are equal after repeated white space sequences are collapased into single spaces.
static boolean containsTextSequence(String srcText, String[] expectedTextSequence)
Returns true if the 'srcText' contains the given sequence of text.
static boolean equalsCollapseWhiteSpace(String string1, String string2)
Tests if two strings are equal after repeated white space sequences are collapased into single spaces.
static int getNumOccurences(String text, String subString)
Counts the number of times that subString occurs within the given text.
static String htmlEncode(String text)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public TextKit ()

Public Methods

public static void assertContainsTextSequence (String srcText, String[] expectedTextSequence)

Returns true if the given expectedTextSequence of Strings all occur within the given srcText in the order given.

Parameters
srcText the text to search
expectedTextSequence the expected text sequence

public static String collapseWhitespace (String text)

Collapses repeated white space ( \n\t) in the string into a single space.

Parameters
text the text to collapse the white space in
Returns
  • a copy of the string with white space collapased to single spaces

public static boolean containsCollapseWhiteSpace (String needle, String haystack)

Tests if two strings are equal after repeated white space sequences are collapased into single spaces.

Parameters
needle the first string to test
haystack the second string to test
Returns
  • true iff string1 and string2 are equal after white space has been collapased

public static boolean containsTextSequence (String srcText, String[] expectedTextSequence)

Returns true if the 'srcText' contains the given sequence of text.

Parameters
srcText the text to search
expectedTextSequence the expected text sequence
Returns
  • true if the 'srcText' contains the given sequence of text.

public static boolean equalsCollapseWhiteSpace (String string1, String string2)

Tests if two strings are equal after repeated white space sequences are collapased into single spaces.

Parameters
string1 the first string to test
string2 the second string to test
Returns
  • true iff string1 and string2 are equal after white space has been collapased

public static int getNumOccurences (String text, String subString)

Counts the number of times that subString occurs within the given text.

Parameters
text The text to search.
subString The subString that we are searching for.
Returns
  • the number of times that subString occurs within the given text.

public static String htmlEncode (String text)