### Question:
StringUtils { public static String collapseLineBreaks(String string) { return replaceLineBreaks(string, EMPTY); } 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 testCollapseLineBreaks() { Assert.assertNull(StringUtils.collapseLineBreaks(null)); Assert.assertEquals("", StringUtils.collapseLineBreaks("")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("foobar")); Assert.assertEquals("foo bar", StringUtils.collapseLineBreaks("foo bar")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("foo\nbar")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("foo\n\nbar")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("foo\rbar")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("foo\r\nbar")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("foo\r\nbar\n")); Assert.assertEquals("foobar", StringUtils.collapseLineBreaks("\rfoo\nbar")); Assert.assertEquals("foo bar", StringUtils.collapseLineBreaks("\rfoo bar\n")); }