ANSIBuilder { private ANSIBuilder(boolean enableAnsi) { ansi = enableAnsi; b = new StringBuilder(); } private  ANSIBuilder(boolean enableAnsi); static ANSIBuilder builder(); static ANSIBuilder builder(boolean enableAnsi); ANSIBuilder resetColors(); ANSIBuilder clear(); ANSIBuilder text(Color color); ANSIBuilder textType(TextType type); ANSIBuilder bg(Color color); ANSIBuilder blackText(); ANSIBuilder redText(); ANSIBuilder greenText(); ANSIBuilder yellowText(); ANSIBuilder blueText(); ANSIBuilder magentaText(); ANSIBuilder cyanText(); ANSIBuilder whiteText(); ANSIBuilder defaultText(); ANSIBuilder blackBg(); ANSIBuilder redBg(); ANSIBuilder greenBg(); ANSIBuilder yellowBg(); ANSIBuilder blueBg(); ANSIBuilder magentaBg(); ANSIBuilder cyanBg(); ANSIBuilder whiteBg(); ANSIBuilder defaultBg(); ANSIBuilder blackText(String text); ANSIBuilder redText(String text); ANSIBuilder greenText(String text); ANSIBuilder yellowText(String text); ANSIBuilder blueText(String text); ANSIBuilder magentaText(String text); ANSIBuilder cyanText(String text); ANSIBuilder whiteText(String text); ANSIBuilder defaultText(String text); ANSIBuilder blackBg(String text); ANSIBuilder redBg(String text); ANSIBuilder greenBg(String text); ANSIBuilder yellowBg(String text); ANSIBuilder blueBg(String text); ANSIBuilder magentaBg(String text); ANSIBuilder cyanBg(String text); ANSIBuilder whiteBg(String text); ANSIBuilder defaultBg(String text); ANSIBuilder append(String data); ANSIBuilder append(int data); ANSIBuilder append(char data); ANSIBuilder append(CharSequence data); ANSIBuilder append(char[] data); ANSIBuilder append(Object data); ANSIBuilder append(StringBuilder data); ANSIBuilder append(float data); ANSIBuilder append(double data); ANSIBuilder append(long data); ANSIBuilder bold(); ANSIBuilder boldOff(); ANSIBuilder faint(); ANSIBuilder faintOff(); ANSIBuilder italic(); ANSIBuilder italicOff(); ANSIBuilder underline(); ANSIBuilder underlineOff(); ANSIBuilder blink(); ANSIBuilder blinkOff(); ANSIBuilder invert(); ANSIBuilder invertOff(); ANSIBuilder conceal(); ANSIBuilder concealOff(); ANSIBuilder crossedOut(); ANSIBuilder crossedOutOff(); ANSIBuilder newline(); ANSIBuilder bold(String text); ANSIBuilder faint(String text); ANSIBuilder italic(String text); ANSIBuilder underline(String text); ANSIBuilder blink(String text); ANSIBuilder invert(String text); ANSIBuilder conceal(String text); ANSIBuilder crossedOut(String text); String toString();  }
@Test public void testAnsiBuilder() { ANSIBuilder builder = ANSIBuilder.builder(); assertEquals(COLOR_START+"0;"+ YELLOW.text()+";"+ DEFAULT.bg()+"m"+"FOO"+RESET, builder.yellowText().append("FOO").toString()); builder.clear(); assertEquals(COLOR_START+"0;"+ YELLOW.text()+";"+ DEFAULT.bg()+"m"+"FOO"+RESET, builder.yellowText("FOO").toString()); builder.clear(); assertEquals("FOO"+COLOR_START+"0;"+ DEFAULT.text()+";"+ BLUE.bg()+"m"+" BAR"+RESET, builder.append("FOO").resetColors().blueBg().append(" BAR").toString()); builder.clear(); assertEquals("FOO"+COLOR_START+"0;"+ DEFAULT.text()+";"+ BLUE.bg()+"m"+" BAR"+RESET, builder.append("FOO").resetColors().blueBg(" BAR").toString()); builder.clear(); assertEquals(COLOR_START+ TextType.BOLD.value()+"mFOO"+ COLOR_START+ TextType.BOLD_OFF.value()+"m BAR"+RESET, builder.bold("FOO").append(' ').append("BAR").toString()); builder = ANSIBuilder.builder(false); assertEquals("FOO BAR", builder.bold("FOO").append(' ').blackBg("BAR").toString()); }