Support plain boolean without option annotations

- Fix so that we can have `boolean arg` without using
  `@Option` or `@ShellOption` defaulting to false.
- Fixes #744
This commit is contained in:
Janne Valkealahti
2023-05-20 14:49:21 +01:00
parent 96402a79b6
commit 8bed75ad77
5 changed files with 43 additions and 27 deletions

View File

@@ -437,8 +437,8 @@ public class StandardMethodTargetRegistrarTests {
assertThat(catalog.getRegistrations().get("foo4")).isNotNull();
assertThat(catalog.getRegistrations().get("foo4").getOptions()).hasSize(1);
assertThat(catalog.getRegistrations().get("foo4").getOptions().get(0).isRequired()).isTrue();
assertThat(catalog.getRegistrations().get("foo4").getOptions().get(0).getDefaultValue()).isNull();
assertThat(catalog.getRegistrations().get("foo4").getOptions().get(0).isRequired()).isFalse();
assertThat(catalog.getRegistrations().get("foo4").getOptions().get(0).getDefaultValue()).isEqualTo("false");
assertThat(catalog.getRegistrations().get("foo4").getOptions().get(0).getArityMin()).isEqualTo(0);
assertThat(catalog.getRegistrations().get("foo4").getOptions().get(0).getArityMax()).isEqualTo(1);
}