Class TextUtils

java.lang.Object
org.apache.rat.testhelpers.TextUtils

public class TextUtils extends Object
Utilities to assert text appears or does not appear in text.
  • Field Details

    • EMPTY

      public static final String[] EMPTY
      An empty list of strings.
  • Constructor Details

    • TextUtils

      public TextUtils()
  • Method Details

    • assertPatternInTarget

      @Deprecated public static void assertPatternInTarget(String pattern, String target)
      Deprecated.
      use assertThat(target).containsPattern(pattern)
      Asserts a regular expression pattern is in a given string.
      Parameters:
      pattern - the pattern to match.
      target - the string to match.
    • assertPatternNotInTarget

      @Deprecated public static void assertPatternNotInTarget(String pattern, String target)
      Deprecated.
      use assertThat(target).doesNotContainPattern(pattern)
      Asserts a regular expression pattern is not in a string.
      Parameters:
      pattern - the pattern to match.
      target - the string to match.
    • isMatching

      @Deprecated public static boolean isMatching(String pattern, String target)
      Deprecated.
      use assertThat(target).matches(pattern)
      Determines if a regular expression pattern is in a string.
      Parameters:
      pattern - the pattern to match.
      target - the string to match.
      Returns:
      true if a regular expression pattern is in a string.
    • readFile

      public static String readFile(File f) throws IOException
      Read given file as UTF-8.
      Parameters:
      f - File to read from.
      Returns:
      contents of the file as UTF-8.
      Throws:
      IOException - in case of I/O-errors.