com.atlassian.jira.functest.framework.util.text
Class TextKit

java.lang.Object
  extended by com.atlassian.jira.functest.framework.util.text.TextKit

public class TextKit
extends Object

A class that handles text assertions and searches.

Since:
v3.13

Constructor Summary
TextKit()
           
 
Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextKit

public TextKit()
Method Detail

collapseWhitespace

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

equalsCollapseWhiteSpace

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
See Also:
collapseWhitespace(java.lang.String)

containsCollapseWhiteSpace

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
See Also:
collapseWhitespace(java.lang.String)

getNumOccurences

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.

containsTextSequence

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.

assertContainsTextSequence

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

htmlEncode

public static String htmlEncode(String text)


Copyright © 2002-2011 Atlassian. All Rights Reserved.