Package org.apache.plc4x.test.migration
Class TestCasePatcher
java.lang.Object
org.apache.plc4x.test.migration.TestCasePatcher
Small util to help with patching of testcases
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdetermineIndent(String xmlDocument, String xmlFragment) Tries to find the base indent for supplied fragmentstatic PatterngetPatternForFragment(String xmlFragment) Returns a pattern for a xmlFragment which ignores leading indents.static StringIndents a xml fragment with the supplied indent (every line gets ident prefixed).
-
Constructor Details
-
TestCasePatcher
public TestCasePatcher()
-
-
Method Details
-
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
Tries to find the base indent for supplied fragment- Parameters:
xmlDocument- where to look for the fragmentxmlFragment- the fragment to look up- Returns:
- the found indent
-
getPatternForFragment
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
-