@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));
    // normal
    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));
    // unusual newline char
    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));
    // short line length
    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));
    // system newline char
    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));
    // with extra spaces
    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));
    // with tab
    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));
    // with tab at wrapColumn
    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));
    // difference because of long word
    input = "Click here to jump to the commons website - https://commons.apache.org";
    expected = "Click here to jump\nto the commons\nwebsite -\nhttps://commons.apache.org";
    assertEquals(expected, Wrap.wrap(input, 20, "\n", false));
    expected = "Click here to jump\nto the commons\nwebsite -\nhttps://commons.apac\nhe.org";
    assertEquals(expected, Wrap.wrap(input, 20, "\n", true));
    // difference because of long word in middle
    input = "Click here, https://commons.apache.org, to jump to the commons website";
    expected = "Click here,\nhttps://commons.apache.org,\nto jump to the\ncommons website";
    assertEquals(expected, Wrap.wrap(input, 20, "\n", false));
    expected = "Click here,\nhttps://commons.apac\nhe.org, to jump to\nthe commons website";
    assertEquals(expected, Wrap.wrap(input, 20, "\n", true));
}