TextUtil { public static String formatJavaDocBox(String text) { requireNonNull(text); return formatTextBox(text, JAVA_DOC_WIDTH, JAVADOC_WORDS, JAVA_DOC_SINGLE_LINE_WORDS); } private  TextUtil(); static Stream<String> wordsOf(String text); static String formatTextBox(String text, int width); static String formatTextBox(String text, int width, Pattern splitter, Set<String> singleRowers); static String formatJavaDocBox(String text); static String alignCenter(String substring, int totalWidth); static String alignCenter(String substring, int totalWidth, char fill); static String alignLeft(String substring, int totalWidth); static String alignLeft(String substring, int totalWidth, char fill); static String alignRight(String substring, int totalWidth); static String alignRight(String substring, int totalWidth, char fill);  }
@Test void testFormatJavaDocBox() { String text = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789."; String eRes = "123456789 123456789 123456789 123456789 123456789 123456789 123456789\n123456789 123456789 123456789 123456789 123456789 123456789."; String result = TextUtil.formatJavaDocBox(text); assertEquals(eRes, result); }