@Test public void when_useridvaluation_valid_no_api_error() { when(userIdValidation.validate(any())).thenReturn(okResult); toTest.checkOwnerUserId(errors, input); verify(errors,never()).rejectValue(eq(ProjectJsonInput.PROPERTY_OWNER), eq("api.error.userid.invalid"), any()); }
public void checkOwnerUserId(Errors errors, ProjectJsonInput input) { ValidationResult userIdValidationResult = userIdValidation.validate(input.getOwner()); if (!userIdValidationResult.isValid()) { errors.rejectValue(ProjectJsonInput.PROPERTY_OWNER, "api.error.userid.invalid", userIdValidationResult.getErrorDescription()); } }
ProjectJsonInputValidation { public void checkOwnerUserId(Errors errors, ProjectJsonInput input) { ValidationResult userIdValidationResult = userIdValidation.validate(input.getOwner()); if (!userIdValidationResult.isValid()) { errors.rejectValue(ProjectJsonInput.PROPERTY_OWNER, "api.error.userid.invalid", userIdValidationResult.getErrorDescription()); } } }
ProjectJsonInputValidation { public void checkOwnerUserId(Errors errors, ProjectJsonInput input) { ValidationResult userIdValidationResult = userIdValidation.validate(input.getOwner()); if (!userIdValidationResult.isValid()) { errors.rejectValue(ProjectJsonInput.PROPERTY_OWNER, "api.error.userid.invalid", userIdValidationResult.getErrorDescription()); } }  }
ProjectJsonInputValidation { public void checkOwnerUserId(Errors errors, ProjectJsonInput input) { ValidationResult userIdValidationResult = userIdValidation.validate(input.getOwner()); if (!userIdValidationResult.isValid()) { errors.rejectValue(ProjectJsonInput.PROPERTY_OWNER, "api.error.userid.invalid", userIdValidationResult.getErrorDescription()); } }  boolean supports(Class<?> clazz); ProjectJsonInput asInput(Object target); void checkProjectId(Errors errors, ProjectJsonInput input); void checkApiVersion(Errors errors, ProjectJsonInput input); void checkOwnerUserId(Errors errors, ProjectJsonInput input); }
ProjectJsonInputValidation { public void checkOwnerUserId(Errors errors, ProjectJsonInput input) { ValidationResult userIdValidationResult = userIdValidation.validate(input.getOwner()); if (!userIdValidationResult.isValid()) { errors.rejectValue(ProjectJsonInput.PROPERTY_OWNER, "api.error.userid.invalid", userIdValidationResult.getErrorDescription()); } }  boolean supports(Class<?> clazz); ProjectJsonInput asInput(Object target); void checkProjectId(Errors errors, ProjectJsonInput input); void checkApiVersion(Errors errors, ProjectJsonInput input); void checkOwnerUserId(Errors errors, ProjectJsonInput input);  }