Class TestCasePatcher

java.lang.Object
org.apache.plc4x.test.migration.TestCasePatcher

public class TestCasePatcher extends Object
Small util to help with patching of testcases
  • Constructor Details

    • TestCasePatcher

      public TestCasePatcher()
  • Method Details

    • indent

      public static String indent(String xmlDocument, String indent)
      Indents a xml fragment with the supplied indent (every line gets ident prefixed).
      Parameters:
      xmlDocument - the document to be patched.
      indent - the indent to be applied
      Returns:
      the indented document
    • determineIndent

      public static String determineIndent(String xmlDocument, String xmlFragment)
      Tries to find the base indent for supplied fragment
      Parameters:
      xmlDocument - where to look for the fragment
      xmlFragment - the fragment to look up
      Returns:
      the found indent
    • getPatternForFragment

      public static Pattern getPatternForFragment(String xmlFragment)
      Returns a pattern for a xmlFragment which ignores leading indents. The first group can be used to determine ident.
      Parameters:
      xmlFragment - the fragment where the pattern should be build for
      Returns:
      the created pattern