use of org.apache.felix.service.threadio.ThreadIO in project karaf by apache.
the class ShellTableTest method testNonUtf8.
private void testNonUtf8(String encoding) throws Exception {
ShellTable table = new ShellTable();
table.column("col1");
table.column("col2").maxSize(-1).wrap();
table.addRow().addContent("my first column value", "my second column value is quite long");
table.size(50);
ThreadIO tio = new ThreadIOImpl();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos, false, encoding);
table.print(ps, true);
tio.setStreams(new FileInputStream(FileDescriptor.in), ps, ps);
table.print(System.out);
assertEquals("col1 | col2\n" + "----------------------+---------------------------\n" + "my first column value | my second column value is\n" + " | quite long\n" + "col1 | col2\n" + "----------------------+---------------------------\n" + "my first column value | my second column value is\n" + " | quite long\n", baos.toString());
}
Aggregations