Search in sources :

Example 6 with ShellTable

use of org.apache.karaf.shell.table.ShellTable in project karaf by apache.

the class ShellTableTest method testNoFormatWithCustomSeparator.

@Test
public void testNoFormatWithCustomSeparator() {
    ShellTable table = new ShellTable();
    table.separator(";");
    table.column(new Col("first"));
    table.column(new Col("second"));
    table.addRow().addContent("first column", "second column");
    StringWriter writer = new StringWriter();
    PrintStream out = new PrintStream(new WriterOutputStream(writer));
    table.print(out, false);
    out.flush();
    String expected = "first column;second column\n";
    Assert.assertEquals(expected, getString(writer));
}
Also used : Col(org.apache.karaf.shell.table.Col) PrintStream(java.io.PrintStream) ShellTable(org.apache.karaf.shell.table.ShellTable) StringWriter(java.io.StringWriter) WriterOutputStream(org.apache.commons.io.output.WriterOutputStream) Test(org.junit.Test)

Aggregations

PrintStream (java.io.PrintStream)6 StringWriter (java.io.StringWriter)6 WriterOutputStream (org.apache.commons.io.output.WriterOutputStream)6 Col (org.apache.karaf.shell.table.Col)6 ShellTable (org.apache.karaf.shell.table.ShellTable)6 Test (org.junit.Test)6 Row (org.apache.karaf.shell.table.Row)1