01: /*
02: Copyright 2004-2007 Paul R. Holser, Jr. All rights reserved.
03: Licensed under the Academic Free License version 3.0
04: */
05:
06: package joptsimple.util;
07:
08: import java.util.Arrays;
09:
10: /**
11: * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
12: * @version $Id: TwoColumnDefaultJustificationTestCase.java,v 1.5 2007/04/10 20:06:26 pholser Exp $
13: */
14: public class TwoColumnDefaultJustificationTestCase extends
15: ColumnarDataTestCase {
16: protected String[] headers() {
17: return new String[] { "first", "second" };
18: }
19:
20: public void testNoRows() {
21: assertEquals(Arrays.asList(new Object[] { "first second ",
22: "----- ------ " }), lines());
23: }
24:
25: public void testFewerDataCellsThanColumns() {
26: grid.addRow(new Object[] { "123" });
27:
28: assertEquals(Arrays.asList(new Object[] { "first second ",
29: "----- ------ ", "123 " }), lines());
30: }
31:
32: public void testFewerDataCellsThanColumnsWithLongData() {
33: grid.addRow(new Object[] { "12345678" });
34:
35: assertEquals(Arrays.asList(new Object[] { "first second ",
36: "-------- ------ ", "12345678 " }), lines());
37: }
38:
39: public void testAsManyDataCellsAsColumnsWithShortData() {
40: grid.addRow(new Object[] { "12", "345" });
41:
42: assertEquals(Arrays.asList(new Object[] { "first second ",
43: "----- ------ ", "12 345 " }), lines());
44: }
45:
46: public void testAsManyDataCellsAsColumnsWithSomeLongData() {
47: grid.addRow(new Object[] { "12", "34567890" });
48:
49: assertEquals(Arrays.asList(new Object[] { "first second ",
50: "----- -------- ", "12 34567890 " }), lines());
51: }
52:
53: public void testAsManyDataCellsAsColumnsWithBothLongData() {
54: grid.addRow(new Object[] { "abcdefg", "123456789" });
55: grid.addRow(new Object[] { "hijklmn", "987654321" });
56:
57: assertEquals(Arrays.asList(new Object[] { "first second ",
58: "------- --------- ", "abcdefg 123456789 ",
59: "hijklmn 987654321 " }), lines());
60: }
61: }
|