Functions { public static String br(String value) { if (value == null || value.isEmpty()) { return ""; } String replacedValue = LINE_BREAK_PATTERN.matcher(value).replaceAll( HTML_TAG_OF_LINE_BREAK); return replacedValue; } private  Functions(); static String h(Object input); static String u(String value); static String br(String value); static String cut(String value, int length); static String link(String value); static String mapToQuery(Map<String, ?> map); @Deprecated static String mapToQuery(Map<String, ?> map,
            BeanWrapper beanWrapper); static String query(Object params); static String js(String value); static String hjs(String input);  }
@Test public void testBr() { assertThat(Functions.br(null), is("")); assertThat(Functions.br(""), is("")); assertThat(Functions.br("abcde\nabcdf"), is("abcde<br />abcdf")); }
@Test public void testBr_CrOnly() { assertThat(Functions.br("\r"), is("<br />")); assertThat(Functions.br("a\r"), is("a<br />")); assertThat(Functions.br("\ra"), is("<br />a")); assertThat(Functions.br("\r\r"), is("<br /><br />")); assertThat(Functions.br("<br />\r\r<br />"), is( "<br /><br /><br /><br />")); }
@Test public void testBr_LfOnly() { assertThat(Functions.br("\n"), is("<br />")); assertThat(Functions.br("a\n"), is("a<br />")); assertThat(Functions.br("\na"), is("<br />a")); assertThat(Functions.br("\n\n"), is("<br /><br />")); assertThat(Functions.br("<br />\n\n<br />"), is( "<br /><br /><br /><br />")); }
@Test public void testBr_CrLfOnly() { assertThat(Functions.br("\r\n"), is("<br />")); assertThat(Functions.br("a\r\n"), is("a<br />")); assertThat(Functions.br("\r\na"), is("<br />a")); assertThat(Functions.br("\r\n\r\n"), is("<br /><br />")); assertThat(Functions.br("<br />\r\n\r\n<br />"), is( "<br /><br /><br /><br />")); }
@Test public void testBr_multi() { assertThat(Functions.br("a\rb\nc\r\nd"), is("a<br />b<br />c<br />d")); assertThat(Functions.br("a\nb\r\nc\rd"), is("a<br />b<br />c<br />d")); assertThat(Functions.br("a\r\nb\rc\nd"), is("a<br />b<br />c<br />d")); }