@Test public void testIssue402() { class AppWithEnum { @Parameters(type = Choices.class) private Choices choice; } AppWithEnum app; try { app = CommandLine.populateCommand(new AppWithEnum(), "CHOICE3"); } catch (ParameterException e) { assertEquals("<choice>", e.getArgSpec().paramLabel()); assertEquals(2, e.getArgSpec().type().getEnumConstants().length); assertEquals(Choices.CHOICE1, e.getArgSpec().type().getEnumConstants()[0]); assertEquals(Choices.CHOICE2, e.getArgSpec().type().getEnumConstants()[1]); assertEquals("CHOICE3", e.getValue()); } } @Test
@Test public void testIssue402() { class AppWithEnum { @Parameters(type = Choices.class) private Choices choice; } AppWithEnum app; try { app = CommandLine.populateCommand(new AppWithEnum(), "CHOICE3"); } catch (ParameterException e) { assertEquals("<choice>", e.getArgSpec().paramLabel()); assertEquals(2, e.getArgSpec().type().getEnumConstants().length); assertEquals(Choices.CHOICE1, e.getArgSpec().type().getEnumConstants()[0]); assertEquals(Choices.CHOICE2, e.getArgSpec().type().getEnumConstants()[1]); assertEquals("CHOICE3", e.getValue()); } } @Test