コード例 #1
0
  @Test
  public void testRedefineStyle() {
    OutputFormatter formatter = new OutputFormatter(true);

    OutputFormatterStyle style = new OutputFormatterStyle("blue", "white");
    formatter.setStyle("info", style);

    assertEquals(
        "\033[34;47msome custom msg\033[0m", formatter.format("<info>some custom msg</info>"));
  }
コード例 #2
0
  @Test
  public void testNewStyle() {
    OutputFormatter formatter = new OutputFormatter(true);

    OutputFormatterStyle style = new OutputFormatterStyle("blue", "white");
    formatter.setStyle("test", style);

    assertEquals(style, formatter.getStyle("test"));
    assertNotSame(style, formatter.getStyle("info"));

    assertEquals(
        "\033[34;47msome custom msg\033[0m", formatter.format("<test>some custom msg</test>"));
  }