### Question:
ReplaceString extends BaseTransform<ReplaceStringMeta, ReplaceStringData> implements ITransform<ReplaceStringMeta, ReplaceStringData> { @VisibleForTesting static Pattern buildPattern( boolean literalParsing, boolean caseSensitive, boolean wholeWord, String patternString, boolean isUnicode ) { int flags = 0; if ( literalParsing && !wholeWord ) { flags |= Pattern.LITERAL; } if ( !caseSensitive ) { flags |= Pattern.CASE_INSENSITIVE; } if ( isUnicode ) { flags |= Pattern.UNICODE_CHARACTER_CLASS; } if ( wholeWord ) { if ( literalParsing ) { patternString = "\\Q" + patternString + "\\E"; } patternString = "\\b" + patternString + "\\b"; } return Pattern.compile( patternString, flags ); } ReplaceString( TransformMeta transformMeta, ReplaceStringMeta meta, ReplaceStringData data, int copyNr, PipelineMeta pipelineMeta,
                        Pipeline pipeline ); static String replaceString( String originalString, Pattern pattern, String replaceByString ); boolean processRow(); boolean init(); void dispose();  }### Answer:
@Test public void testBuildPatternWithLiteralParsingAndWholeWord() throws Exception { Pattern actualPattern = ReplaceString.buildPattern( true, true, true, LITERAL_STRING, false ); Matcher matcher = actualPattern.matcher( INPUT_STRING ); String actualString = matcher.replaceAll( "are" ); Assert.assertEquals( INPUT_STRING, actualString ); }
@Test public void testBuildPatternWithNonLiteralParsingAndWholeWord() throws Exception { Pattern actualPattern = ReplaceString.buildPattern( false, true, true, LITERAL_STRING, false ); Matcher matcher = actualPattern.matcher( INPUT_STRING ); String actualString = matcher.replaceAll( "are" ); Assert.assertEquals( "This are String This Is String THIS IS STRING", actualString ); }