@Test public void testNoHeaderColumns() { // when AsciiArtTable aat = new AsciiArtTable(); aat.setNoHeaderColumns(3); aat.add("bello", "pussy", "hans"); aat.add(1, 2, 3., "a very long thing"); // have a visual impression (not part of the test) aat.print(System.out); // then String expected = ""; expected += "╔═══════════════════╤═══════╤══════╗" + System.lineSeparator(); expected += "║ bello │ pussy │ hans ║" + System.lineSeparator(); expected += "╟───────────────────┼───────┼──────╢" + System.lineSeparator(); expected += "║ 1 │ 2 │ 3.0 ║" + System.lineSeparator(); expected += "╟───────────────────┼───────┼──────╢" + System.lineSeparator(); expected += "║ a very long thing │ │ ║" + System.lineSeparator(); expected += "╚═══════════════════╧═══════╧══════╝" + System.lineSeparator(); assertEquals(expected, aat.getOutput()); }
@Test public void testNoHeaderColumnsButHeadlineWithPaddingAndCustomBorders() { // when AsciiArtTable aat = new AsciiArtTable(3); aat.addHeadline("Some test headline"); aat.setNoHeaderColumns(3); aat.add("bello", "pussy", "hans"); aat.add(1, 2, 3., "a very long thing"); aat.setBorderCharacters("╭──╮││ ─││⎬⎨│╰─╯│"); // have a visual impression (not part of the test) aat.print(System.out); // then String expected = ""; expected += "╭──────────────────────────────────────────────╮" + System.lineSeparator(); expected += "│ Some test headline │" + System.lineSeparator(); expected += "⎬──────────────────────────────────────────────⎨" + System.lineSeparator(); expected += "│ bello │ pussy │ hans │" + System.lineSeparator(); expected += "│ │ │ │" + System.lineSeparator(); expected += "│ 1 │ 2 │ 3.0 │" + System.lineSeparator(); expected += "│ │ │ │" + System.lineSeparator(); expected += "│ a very long thing │ │ │" + System.lineSeparator(); expected += "╰──────────────────────────────────────────────╯" + System.lineSeparator(); assertEquals(expected, aat.getOutput()); }