### Question:
StringUtils { public static String replaceLineBreaks(String string, String replace) { if (string == null) return null; return string.replaceAll("\\r\\n|\\r|\\n", replace); } private  StringUtils(); static String byteToHex(byte[] data); static String replaceLineBreaksWithSpace(String string); static String collapseLineBreaks(String string); static String replaceLineBreaks(String string, String replace); static String removeWhiteSpaces(String string); static String tryTrim(String string); static int getLevenshteinDistance(CharSequence s, CharSequence t); static String join(Object[] array, char separator); static String join(Object[] array, char separator, int startIndex, int endIndex); static String join(Iterator<T> iterator, String separator); static String join(Collection<T> collection, String separator); static final String EMPTY; static final String SPACE; }### Answer:
@Test public void testReplaceLineBreaks() { Assert.assertNull(StringUtils.replaceLineBreaks(null, "abc")); Assert.assertEquals("", StringUtils.replaceLineBreaks("", "abc")); Assert.assertEquals("foobar", StringUtils.replaceLineBreaks("foobar", "abc")); Assert.assertEquals("foo bar", StringUtils.replaceLineBreaks("foo bar", "abc")); Assert.assertEquals("fooabcbar", StringUtils.replaceLineBreaks("foo\nbar", "abc")); Assert.assertEquals("fooabcabcbar", StringUtils.replaceLineBreaks("foo\n\nbar", "abc")); Assert.assertEquals("fooabcbar", StringUtils.replaceLineBreaks("foo\rbar", "abc")); Assert.assertEquals("fooabcbar", StringUtils.replaceLineBreaks("foo\r\nbar", "abc")); Assert.assertEquals("fooabcbarabc", StringUtils.replaceLineBreaks("foo\r\nbar\n", "abc")); Assert.assertEquals("abcfooabcbar", StringUtils.replaceLineBreaks("\rfoo\nbar", "abc")); Assert.assertEquals("abcfoo barabc", StringUtils.replaceLineBreaks("\rfoo bar\n", "abc")); }