### Question:
GlobalUtils { public static String replacePlaceholders(final String input, final String placeholder, final String replacement) { if (Strings.isNullOrEmpty(input)) { return ""; } final StringBuffer buffer = new StringBuffer(input); try { final Pattern pattern = Pattern.compile("(#" + placeholder + "#)", Pattern.MULTILINE); Matcher matcher = pattern.matcher(buffer); while (matcher.find()) { buffer.replace(matcher.start(), matcher.end(), replacement); } } catch (Exception ignore) { } return buffer.toString(); } private  GlobalUtils(); static String replacePlaceholders(final String input, final String placeholder, final String replacement); static String readStreamAsText(final InputStream stream); static void populateDirectories(final Path startPath, final List<Path> existing); static StringBuilder readTextFile(final Path path); static void writeToFile(final CharSequence content, final Path path); static String createMethodName(final String name); static String createClassName(final String input); static String getNamespacePrefix(final String fullName); static String getNameAfterPrefix(final String fullName); @SuppressWarnings("HippoHstCallNodeRefreshInspection") static void refreshSession(final Session session, final boolean keepChanges); static Session createSession(); static void cleanupSession(final Session session); static T newInstance(final Class<T> clazz); @SuppressWarnings("unchecked") static T newInstance(final String className); static Class<?> loadCLass(final String clazz); static String decodeUrl(final String url); static String validFileName(final String input); static boolean marshalWriter(final Writer writer, final Document document); @SuppressWarnings("unchecked") static T unmarshalStream(final InputStream stream, final Class<T> clazz);  }### Answer:
@Test public void testReplacePlaceholders() throws Exception { final InputStream resourceAsStream = getClass().getResourceAsStream("/news_template.xml"); String input = GlobalUtils.readStreamAsText(resourceAsStream); assertTrue("expected valid String", input != null); String output = input; assertEquals(input, output); output = GlobalUtils.replacePlaceholders(input, "NAMESPACE", REPLACE_NAMESPACE); assertNotEquals(input, output); input = output; assertEquals(input, output); output = GlobalUtils.replacePlaceholders(input, "DOCUMENT_NAME", REPLACE_DOC_NAME); assertNotEquals(input, output); assertTrue("expected NAMESPACE replacement", output.contains(REPLACE_NAMESPACE)); assertTrue("expected DOCUMENT_NAME replacement", output.contains(REPLACE_DOC_NAME)); }