lukaszlenart commented on a change in pull request #499:
URL: https://github.com/apache/struts/pull/499#discussion_r720306338
##########
File path:
plugins/oval/src/test/java/org/apache/struts2/oval/interceptor/OValValidationInterceptorTest.java
##########
@@ -308,24 +296,12 @@ public void testMemberObject() throws Exception {
Map<String, List<String>> fieldErrors = ((ValidationAware)
baseActionProxy.getAction()).getFieldErrors();
assertNotNull(fieldErrors);
- assertEquals(5, fieldErrors.size()); // 5: as there will be field
errors for 'person' and 'person.address' themselves
- assertValue(fieldErrors, "person.name", Arrays.asList("name cannot be
null"));
- assertValue(fieldErrors, "person.email", Arrays.asList("email cannot
be null"));
- try {
- // Oval version <= 1.40 validation error for invalid data reports:
"net.sf.oval.constraint.AssertValid.violated".
- assertValue(fieldErrors, "person.address",
Arrays.asList("net.sf.oval.constraint.AssertValid.violated"));
- // Oval version <= 1.40 validation error for minimum length
reports: "street cannot be smaller than 7 characters".
- assertValue(fieldErrors, "person.address.street",
Arrays.asList("street cannot be smaller than 7 characters"));
- } catch (AssertionFailedError afe) {
- // Oval version >= 1.50 validation error for invalid data reports:
"address is invalid".
- assertValue(fieldErrors, "person.address", Arrays.asList("address
is invalid"));
- // Oval version >= 1.50 validation error for minimum length
reports: "street cannot be shorter than 7 characters".
- assertValue(fieldErrors, "person.address.street",
Arrays.asList("street cannot be shorter than 7 characters"));
- }
-
+ assertEquals(3, fieldErrors.size()); // 5: as there will be field
errors for 'person' and 'person.address' themselves
Review comment:
👍
##########
File path:
plugins/oval/src/test/java/org/apache/struts2/oval/interceptor/OValValidationInterceptorTest.java
##########
@@ -281,21 +280,10 @@ public void testModelDrivenAction() throws Exception {
Map<String, List<String>> fieldErrors = ((ValidationAware)
baseActionProxy.getAction()).getFieldErrors();
assertNotNull(fieldErrors);
- assertEquals(5, fieldErrors.size()); // 5: as there will be field
errors for 'model' and 'address' themselves
- assertValue(fieldErrors, "name", Arrays.asList("name cannot be null"));
- assertValue(fieldErrors, "email", Arrays.asList("email cannot be
null"));
- try {
- // Oval version <= 1.40 validation error for invalid data reports:
"net.sf.oval.constraint.AssertValid.violated".
- assertValue(fieldErrors, "address",
Arrays.asList("net.sf.oval.constraint.AssertValid.violated"));
- // Oval version <= 1.40 validation error for minimum length
reports: "street cannot be smaller than 7 characters".
- assertValue(fieldErrors, "address.street", Arrays.asList("street
cannot be smaller than 7 characters"));
- } catch (AssertionFailedError afe) {
- // Oval version >= 1.50 validation error for invalid data reports:
"address is invalid".
- assertValue(fieldErrors, "address", Arrays.asList("address is
invalid"));
- // Oval version >= 1.50 validation error for minimum length
reports: "street cannot be shorter than 7 characters".
- assertValue(fieldErrors, "address.street", Arrays.asList("street
cannot be shorter than 7 characters"));
- }
-
+ assertEquals(3, fieldErrors.size()); // 5: as there will be field
errors for 'model' and 'address' themselves
Review comment:
👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]