コード例 #1
0
ファイル: CmdLineTest.java プロジェクト: tomgagnier/public
 private void assertCorrectValues() {
   assertEquals(Boolean.TRUE, b1.getValue());
   assertEquals(B2_DEFAULT, b2.value());
   assertEquals(B3_DEFAULT, b3.value());
   assertEquals(1, i1.value());
   assertEquals(I2_DEFAULT, i2.value());
   assertEquals(I3_DEFAULT, i3.value());
   assertEquals(Arrays.asList(new String[] {"hello", "world"}), Arrays.asList(sa1.value()));
   assertEquals(Arrays.asList(SA2_DEFAULT), Arrays.asList(sa2.value()));
   assertEquals(s1.value(), "goodnight");
   assertEquals(s2.value(), S2_DEFAULT);
   assertEquals(cmdLine.getArguments(), Arrays.asList(new String[] {"arg1", "arg2"}));
   assertEquals(Boolean.TRUE.toString(), b1.toString());
   assertEquals(S2_DEFAULT, s2.toString());
   final String expected =
       getClass().getName()
           + "{?=false"
           + ", b1=true, b2=true, b3=false"
           + ", i1=1, i2=2, i3=-1"
           + ", s1=goodnight, s2=s2-default"
           + ", sa1=[hello, world], sa2=[1, 2, 3]}"
           + "[arg1, arg2]";
   assertEquals(expected, cmdLine.toString());
 }
コード例 #2
0
ファイル: CmdLineTest.java プロジェクト: tomgagnier/public
 /** Test empty array index. */
 public void testEmptyArrayIndex() throws Exception {
   final String[] args = new String[] {B1, I1, "1", SA1, S1, "goodnight", "arg1", "arg2"};
   cmdLine.parse(args);
   assertEquals(0, sa1.value().length);
 }