renderWrappedText(sb, width, nextLineTabStop, line);
@Test public void testRenderWrappedTextWordCut() { int width = 7; int padding = 0; String text = "Thisisatest."; String expected = "Thisisa" + EOL + "test."; StringBuffer sb = new StringBuffer(); new HelpFormatter().renderWrappedText(sb, width, padding, text); assertEquals("cut and wrap", expected, sb.toString()); }
@Test public void testRenderWrappedTextSingleLinePadded() { // single line padded text int width = 12; int padding = 4; String text = "This is a test."; String expected = "This is a" + EOL + " test."; StringBuffer sb = new StringBuffer(); new HelpFormatter().renderWrappedText(sb, width, padding, text); assertEquals("single line padded text", expected, sb.toString()); }
@Test public void testRenderWrappedTextMultiLine() { // multi line text int width = 16; int padding = 0; String expected = "aaaa aaaa aaaa" + EOL + "aaaaaa" + EOL + "aaaaa"; StringBuffer sb = new StringBuffer(); new HelpFormatter().renderWrappedText(sb, width, padding, expected); assertEquals("multi line text", expected, sb.toString()); }
@Test public void testRenderWrappedTextSingleLine() { // single line text int width = 12; int padding = 0; String text = "This is a test."; String expected = "This is a" + EOL + "test."; StringBuffer sb = new StringBuffer(); new HelpFormatter().renderWrappedText(sb, width, padding, text); assertEquals("single line text", expected, sb.toString()); }
@Test public void testRenderWrappedTextSingleLinePadded2() { // single line padded text 2 int width = 53; int padding = 24; String text = " -p,--period <PERIOD> PERIOD is time duration of form " + "DATE[-DATE] where DATE has form YYYY[MM[DD]]"; String expected = " -p,--period <PERIOD> PERIOD is time duration of" + EOL + " form DATE[-DATE] where DATE" + EOL + " has form YYYY[MM[DD]]"; StringBuffer sb = new StringBuffer(); new HelpFormatter().renderWrappedText(sb, width, padding, text); assertEquals("single line padded text 2", expected, sb.toString()); }
@Test public void testRenderWrappedTextMultiLinePadded() { // multi-line padded text int width = 16; int padding = 4; String text = "aaaa aaaa aaaa" + EOL + "aaaaaa" + EOL + "aaaaa"; String expected = "aaaa aaaa aaaa" + EOL + " aaaaaa" + EOL + " aaaaa"; StringBuffer sb = new StringBuffer(); new HelpFormatter().renderWrappedText(sb, width, padding, text); assertEquals("multi-line padded text", expected, sb.toString()); }
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
lineBuilder.append(option.getDescription()); super.renderWrappedText(buffer, width, maxOptionLinePrefixLength + descriptionPaddingWidth,
/** * <p>Print the specified text to the specified PrintWriter.</p> * * @param pw The printWriter to write the help to * @param width The number of characters to display per line * @param nextLineTabStop The position on the next line for the first tab. * @param text The text to be written to the PrintWriter */ public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) { StringBuffer sb = new StringBuffer(text.length()); renderWrappedText(sb, width, nextLineTabStop, text); pw.println(sb.toString()); }
/** * <p>Print the specified text to the specified PrintWriter.</p> * * @param pw The printWriter to write the help to * @param width The number of characters to display per line * @param nextLineTabStop The position on the next line for the first tab. * @param text The text to be written to the PrintWriter */ public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) { StringBuffer sb = new StringBuffer(text.length()); renderWrappedText(sb, width, nextLineTabStop, text); pw.println(sb.toString()); }
/** * Print the specified text to the specified PrintWriter. * * @param pw The printWriter to write the help to * @param width The number of characters to display per line * @param nextLineTabStop The position on the next line for the first tab. * @param text The text to be written to the PrintWriter */ public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) { StringBuffer sb = new StringBuffer(text.length()); renderWrappedText(sb, width, nextLineTabStop, text); pw.println(sb.toString()); }
/** * Print the specified text to the specified PrintWriter. * * @param pw The printWriter to write the help to * @param width The number of characters to display per line * @param nextLineTabStop The position on the next line for the first tab. * @param text The text to be written to the PrintWriter */ public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) { StringBuffer sb = new StringBuffer(text.length()); renderWrappedText(sb, width, nextLineTabStop, text); pw.println(sb.toString()); }
renderWrappedText(sb, width, nextLineTabStop, line);
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());