Skip to content

Commit

Permalink
#571 fixed CommandReflection tests (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Dec 21, 2018
1 parent 319a32d commit 2afd304
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/picocli/CommandLineModelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,8 @@ static class ValidateArgSpecField {

@Option(names = "-final")
final Object f = new Object();

int neither;
}

@Test
Expand Down Expand Up @@ -2540,6 +2542,16 @@ public void testCommandReflection_validateArgSpecField_final() throws Exception
validateArgSpecField.invoke(null, typedMember); // no error
}

@Test
public void testCommandReflection_validateArgSpecField_neither() throws Exception {
Class<?> reflection = Class.forName("picocli.CommandLine$Model$CommandReflection");
Method validateArgSpecField = reflection.getDeclaredMethod("validateArgSpecField", TypedMember.class);
validateArgSpecField.setAccessible(true);

TypedMember typedMember = new TypedMember(ValidateArgSpecField.class.getDeclaredField("neither"));
validateArgSpecField.invoke(null, typedMember); // no error
}

static class ValidateInjectSpec {
int notAnnotated;

Expand Down

0 comments on commit 2afd304

Please sign in to comment.