/*
Copyright 2004-2007 Paul R. Holser, Jr. All rights reserved.
Licensed under the Academic Free License version 3.0
*/
package joptsimple.util;
import java.util.Arrays;
/**
* @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
* @version $Id: TwoColumnDefaultJustificationTestCase.java,v 1.5 2007/04/10 20:06:26 pholser Exp $
*/
public class TwoColumnDefaultJustificationTestCase extends ColumnarDataTestCase {
protected String[] headers() {
return new String[] { "first", "second" };
}
public void testNoRows() {
assertEquals(
Arrays.asList( new Object[] { "first second ", "----- ------ " } ),
lines() );
}
public void testFewerDataCellsThanColumns() {
grid.addRow( new Object[] { "123" } );
assertEquals(
Arrays.asList(
new Object[] { "first second ", "----- ------ ", "123 " } ),
lines() );
}
public void testFewerDataCellsThanColumnsWithLongData() {
grid.addRow( new Object[] { "12345678" } );
assertEquals(
Arrays.asList(
new Object[] {
"first second ",
"-------- ------ ",
"12345678 "
} ),
lines() );
}
public void testAsManyDataCellsAsColumnsWithShortData() {
grid.addRow( new Object[] { "12", "345" } );
assertEquals(
Arrays.asList(
new Object[] {
"first second ",
"----- ------ ",
"12 345 " } ),
lines() );
}
public void testAsManyDataCellsAsColumnsWithSomeLongData() {
grid.addRow( new Object[] { "12", "34567890" } );
assertEquals(
Arrays.asList(
new Object[] {
"first second ",
"----- -------- ",
"12 34567890 " } ),
lines() );
}
public void testAsManyDataCellsAsColumnsWithBothLongData() {
grid.addRow( new Object[] { "abcdefg", "123456789" } );
grid.addRow( new Object[] { "hijklmn", "987654321" } );
assertEquals(
Arrays.asList(
new Object[] {
"first second ",
"------- --------- ",
"abcdefg 123456789 ",
"hijklmn 987654321 " } ),
lines() );
}
}
|