@Test
public void testWrapString() {

    validateResult(
            new String[]{"abc", "abcdef", "abcdef"},
            StringWrapper.wrapString("abc\nabcdefabcdef", 6, null));
    validateResult(
            new String[]{"abc"},
            StringWrapper.wrapString("abc", 6, new String[3]));
    validateResult(
            new String[]{"abc"},
            StringWrapper.wrapString("abc", 6, new String[0]));
    validateResult(
            new String[]{"abc"},
            StringWrapper.wrapString("abc", 6, new String[1]));
    validateResult(
            new String[]{""},
            StringWrapper.wrapString("", 6, new String[3]));
    validateResult(
            new String[]{"abcdef"},
            StringWrapper.wrapString("abcdef", 6, new String[3]));
    validateResult(
            new String[]{"abcdef", "abcdef"},
            StringWrapper.wrapString("abcdef\nabcdef", 6, new String[3]));
    validateResult(
            new String[]{"abc", "", "def"},
            StringWrapper.wrapString("abc\n\ndef", 6, new String[3]));
    validateResult(
            new String[]{"", "abcdef"},
            StringWrapper.wrapString("\nabcdef", 6, new String[3]));
    validateResult(
            new String[]{"", "", "abcdef"},
            StringWrapper.wrapString("\n\nabcdef", 6, new String[3]));
    validateResult(
            new String[]{"", "", "abcdef"},
            StringWrapper.wrapString("\n\nabcdef", 6, new String[4]));
    validateResult(
            new String[]{"", "", "abcdef", ""},
            StringWrapper.wrapString("\n\nabcdef\n\n", 6, new String[4]));
    validateResult(
            new String[]{"", "", "abcdef", "a", ""},
            StringWrapper.wrapString("\n\nabcdefa\n\n", 6, new String[4]));
    validateResult(
            new String[]{"", "", "abcdef", "a", ""},
            StringWrapper.wrapString("\n\nabcdefa\n\n", 6, new String[0]));
    validateResult(
            new String[]{"", "", "abcdef", "a", ""},
            StringWrapper.wrapString("\n\nabcdefa\n\n", 6, new String[5]));
    validateResult(
            new String[]{"", "", "a", "b", "c", "d", "e", "f", "a", ""},
            StringWrapper.wrapString("\n\nabcdefa\n\n", 1, new String[5]));
}