-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checking if beandescriptor is null #672
Conversation
can you add an unit test catching this case? |
This behavior is too strange. Javadocs are not clear if I did some tests and public void m0() { }
public void m1(String name) { }
public void m2(@NotNull String name) { }
@Test
public void foo() {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
BeanDescriptor bean = validator.getConstraintsForClass(AppTest.class);
System.out.println("bean " + bean);
System.out.println("m0 " + bean.getConstraintsForMethod("m0"));
System.out.println("m1 " + bean.getConstraintsForMethod("m1", String.class));
System.out.println("m2 " + bean.getConstraintsForMethod("m2", String.class));
} Prints:
For me, there are no problem with this null check, but I don't think that this scenario will happen. |
You are right, Otavio... I could not reproduce this scenario in the unit tests... But when I run the integration tests in vraptor-test, the problem always happens :(. My guess is that a problem with proxies or any other thing that we are not being able to see. |
@@ -94,6 +99,14 @@ public void shouldNotAcceptIfMethodHasConstraint() { | |||
getMethodValidator().validate(new MethodReady(withoutConstraint), controller, methodInfo, validator); | |||
verify(controller, never()).getController(); | |||
} | |||
|
|||
@Test | |||
public void shouldNotAcceptIfMethodDoesNotHaveConstraingAndHasDomainObjectParameter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Constraing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed here c1bb8d5
I think its good to merge... this is a simple null check, if helps on plugin 👍 |
Yes, good to merge if this can help vraptor test. But be carefully because |
🐑 |
checking if beandescriptor is null
merged thanks! |
Unused import CdiProxies. |
removed here b01599d |
If the parameter does not have any constraint, the returned BeanDescriptor is null...