Skip to content
Permalink
Browse files
add test for BVAL-158
  • Loading branch information
mbenson committed Oct 17, 2018
1 parent b421b5b commit 27ffadf47968f16120176cf1489d18f4b9e9fbb2
Showing 1 changed file with 16 additions and 0 deletions.
@@ -18,7 +18,9 @@

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.List;

import javax.validation.Valid;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.constraints.NotNull;
@@ -199,6 +201,12 @@ public void validateImplementedMethod() throws NoSuchMethodException {
mv.validateParameters(um, classMethod, new Object[] { "", "valid", null }).size());
}

public void testBVal158() throws NoSuchMethodException {
TypeWithPseudoAccessor target = new TypeWithPseudoAccessor();
Method m = TypeWithPseudoAccessor.class.getMethod("getAll");
assertTrue(getValidator().forExecutables().validateParameters(target, m, new Object[] {}).isEmpty());
}

public static interface UserMethods {
void findUser(String param1, String param2, Integer param3);
}
@@ -210,6 +218,14 @@ public void findUser(@Size(min = 1) String param1, @NotNull String param2, @NotN
}
}

public static class TypeWithPseudoAccessor {
@Valid
@NotNull
public List<Object> getAll() {
throw new IllegalStateException();
}
}

private Validator getValidator() {
return Validation.byProvider(ApacheValidationProvider.class).configure().buildValidatorFactory().getValidator();
}

0 comments on commit 27ffadf

Please sign in to comment.