### Question:
StringUtils { public static String replace(String originalString, String partToMatch, String replacement) { StringBuffer buffer = new StringBuffer(originalString.length()); buffer.append(originalString); int indexOf = buffer.indexOf(partToMatch); while (indexOf != -1) { buffer = buffer.replace(indexOf, indexOf + partToMatch.length(), replacement); indexOf = buffer.indexOf(partToMatch); } return buffer.toString(); }  static Integer toInteger(StringBuilder value); static String toString(StringBuilder value); static Boolean toBoolean(StringBuilder value); static String fromInteger(Integer value); static String fromLong(Long value); static String fromString(String value); static String fromBoolean(Boolean value); static String fromBigInteger(BigInteger value); static String fromBigDecimal(BigDecimal value); static BigInteger toBigInteger(String s); static BigDecimal toBigDecimal(String s); static String fromFloat(Float value); static String fromDate(Date value); static String fromDouble(Double d); static String fromByte(Byte b); static String fromByteBuffer(ByteBuffer byteBuffer); static String replace(String originalString, String partToMatch, String replacement); static String join(String joiner, String... parts); static String lowerCase(String str); static String upperCase(String str); @SuppressWarnings("checkstyle:innerassignment") static boolean isBlank(final CharSequence cs); static final Charset UTF8; }### Answer:
@Test public void testReplace() { final String orig = "To have or not to have"; final String replacement = "be"; assertEquals(StringUtils.replace(orig, "have", replacement), "To be or not to be"); }