@Test public void testWrap_StringIntStringBoolean() { assertNull(Wrap.wrap(null, 20, "\n", false)); assertNull(Wrap.wrap(null, 20, "\n", true)); assertNull(Wrap.wrap(null, 20, null, true)); assertNull(Wrap.wrap(null, 20, null, false)); assertNull(Wrap.wrap(null, -1, null, true)); assertNull(Wrap.wrap(null, -1, null, false)); assertEquals("", Wrap.wrap("", 20, "\n", false)); assertEquals("", Wrap.wrap("", 20, "\n", true)); assertEquals("", Wrap.wrap("", 20, null, false)); assertEquals("", Wrap.wrap("", 20, null, true)); assertEquals("", Wrap.wrap("", -1, null, false)); assertEquals("", Wrap.wrap("", -1, null, true)); String input = "Here is one line of text that is going to be wrapped after 20 columns."; String expected = "Here is one line of\ntext that is going\nto be wrapped after\n20 columns."; assertEquals(expected, Wrap.wrap(input, 20, "\n", false)); assertEquals(expected, Wrap.wrap(input, 20, "\n", true)); input = "Here is one line of text that is going to be wrapped after 20 columns."; expected = "Here is one line of<br />text that is going<br />to be wrapped after<br />20 columns."; assertEquals(expected, Wrap.wrap(input, 20, "<br />", false)); assertEquals(expected, Wrap.wrap(input, 20, "<br />", true)); input = "Here is one line"; expected = "Here\nis one\nline"; assertEquals(expected, Wrap.wrap(input, 6, "\n", false)); expected = "Here\nis\none\nline"; assertEquals(expected, Wrap.wrap(input, 2, "\n", false)); assertEquals(expected, Wrap.wrap(input, -1, "\n", false)); final String systemNewLine = System.lineSeparator(); input = "Here is one line of text that is going to be wrapped after 20 columns."; expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine + "to be wrapped after" + systemNewLine + "20 columns."; assertEquals(expected, Wrap.wrap(input, 20, null, false)); assertEquals(expected, Wrap.wrap(input, 20, null, true)); input = " Here: is one line of text that is going to be wrapped after 20 columns."; expected = "Here: is one line\nof text that is \ngoing to be \nwrapped after 20 \ncolumns."; assertEquals(expected, Wrap.wrap(input, 20, "\n", false)); assertEquals(expected, Wrap.wrap(input, 20, "\n", true)); input = "Here is\tone line of text that is going to be wrapped after 20 columns."; expected = "Here is\tone line of\ntext that is going\nto be wrapped after\n20 columns."; assertEquals(expected, Wrap.wrap(input, 20, "\n", false)); assertEquals(expected, Wrap.wrap(input, 20, "\n", true)); input = "Here is one line of\ttext that is going to be wrapped after 20 columns."; expected = "Here is one line\nof\ttext that is\ngoing to be wrapped\nafter 20 columns."; assertEquals(expected, Wrap.wrap(input, 20, "\n", false)); assertEquals(expected, Wrap.wrap(input, 20, "\n", true)); input = "Click here to jump to the commons website - https: expected = "Click here to jump\nto the commons\nwebsite -\nhttps: assertEquals(expected, Wrap.wrap(input, 20, "\n", false)); expected = "Click here to jump\nto the commons\nwebsite -\nhttps: assertEquals(expected, Wrap.wrap(input, 20, "\n", true)); input = "Click here, https: expected = "Click here,\nhttps: assertEquals(expected, Wrap.wrap(input, 20, "\n", false)); expected = "Click here,\nhttps: assertEquals(expected, Wrap.wrap(input, 20, "\n", true)); }
private Wrap() { }
Wrap { private Wrap() { } }
Wrap { private Wrap() { } private  Wrap(); }
Wrap { private Wrap() { } private  Wrap(); static int length(final CharSequence cs); static boolean isBlank(final CharSequence cs); static String wrap(final String str, final int wrapLength); static String wrap(final String str, final int wrapLength, final String newLineStr, final boolean wrapLongWords); static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords, String wrapOn); }
Wrap { private Wrap() { } private  Wrap(); static int length(final CharSequence cs); static boolean isBlank(final CharSequence cs); static String wrap(final String str, final int wrapLength); static String wrap(final String str, final int wrapLength, final String newLineStr, final boolean wrapLongWords); static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords, String wrapOn);  }