@Test
public void testCliParse() throws Exception {

    String[] args = {
            "--my-value", "value",
            "--my-num", "7",
            "--no-negative-flag",
            "--my-enum", "TwoFoo",
            "--my-array", "one",
            "--my-array", "two",
            "--my-array", "three",
            "--my-flag"
    };
    ConfigWrapper<Foo> wrapper = ConfigUtil.wrapperFor(Foo.class);
    CommandLine commandLine = new DefaultParser().parse(wrapper.getOptions(), args);
    Foo foo = new Foo();
    foo.setMyValue("value");
    foo.setMyNum(7);
    foo.setMyFlag(true);
    foo.setNegativeFlag(false);
    foo.setMyEnum(FooType.TwoFoo);
    foo.setMyArray(new String[]{"one", "two", "three"});
    Foo foo2 = wrapper.parse(commandLine);
    Assert.assertEquals(foo.getMyValue(), foo2.getMyValue());
    Assert.assertEquals(foo.getMyNum(), foo2.getMyNum());
    Assert.assertEquals(foo.isMyFlag(), foo2.isMyFlag());
    Assert.assertEquals(foo.isNegativeFlag(), foo2.isNegativeFlag());
    Assert.assertEquals(foo.getMyEnum(), foo2.getMyEnum());
    Assert.assertArrayEquals(foo.getMyArray(), foo2.getMyArray());
}