Browse Source

Polishing

pull/894/merge
Juergen Hoeller 7 years ago
parent
commit
95a56cd28d
  1. 8
      spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java
  2. 14
      spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java
  3. 2
      spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java
  4. 5
      spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java

8
spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import org.springframework.util.ObjectUtils; @@ -24,7 +24,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* Default implementation of the {@link MessageSourceResolvable} interface.
* Spring's default implementation of the {@link MessageSourceResolvable} interface.
* Offers an easy way to store all the necessary values needed to resolve
* a message via a {@link org.springframework.context.MessageSource}.
*
@ -143,8 +143,8 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable, @@ -143,8 +143,8 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
}
/**
* Default implementation exposes the attributes of this MessageSourceResolvable.
* To be overridden in more specific subclasses, potentially including the
* The default implementation exposes the attributes of this MessageSourceResolvable.
* <p>To be overridden in more specific subclasses, potentially including the
* resolvable content through {@code resolvableToString()}.
* @see #resolvableToString()
*/

14
spring-context/src/test/java/org/springframework/validation/beanvalidation/SpringValidatorAdapterTests.java

@ -72,7 +72,7 @@ public class SpringValidatorAdapterTests { @@ -72,7 +72,7 @@ public class SpringValidatorAdapterTests {
@Before
public void setupSpringValidatorAdapter() {
messageSource.addMessage("Size", Locale.ENGLISH, "Size of {0} is must be between {2} and {1}");
messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value with {1}");
messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value as {1}");
messageSource.addMessage("password", Locale.ENGLISH, "Password");
messageSource.addMessage("confirmPassword", Locale.ENGLISH, "Password(Confirm)");
}
@ -115,7 +115,7 @@ public class SpringValidatorAdapterTests { @@ -115,7 +115,7 @@ public class SpringValidatorAdapterTests {
assertThat(errors.getFieldValue("password"), is("password"));
FieldError error = errors.getFieldError("password");
assertNotNull(error);
assertThat(messageSource.getMessage(error, Locale.ENGLISH), is("Password must be same value with Password(Confirm)"));
assertThat(messageSource.getMessage(error, Locale.ENGLISH), is("Password must be same value as Password(Confirm)"));
assertTrue(error.contains(ConstraintViolation.class));
assertThat(error.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("password"));
}
@ -136,7 +136,7 @@ public class SpringValidatorAdapterTests { @@ -136,7 +136,7 @@ public class SpringValidatorAdapterTests {
FieldError error2 = errors.getFieldError("confirmEmail");
assertNotNull(error1);
assertNotNull(error2);
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value with confirmEmail"));
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value as confirmEmail"));
assertThat(messageSource.getMessage(error2, Locale.ENGLISH), is("Email required"));
assertTrue(error1.contains(ConstraintViolation.class));
assertThat(error1.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("email"));
@ -162,7 +162,7 @@ public class SpringValidatorAdapterTests { @@ -162,7 +162,7 @@ public class SpringValidatorAdapterTests {
FieldError error2 = errors.getFieldError("confirmEmail");
assertNotNull(error1);
assertNotNull(error2);
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value with confirmEmail"));
assertThat(messageSource.getMessage(error1, Locale.ENGLISH), is("email must be same value as confirmEmail"));
assertThat(messageSource.getMessage(error2, Locale.ENGLISH), is("Email required"));
assertTrue(error1.contains(ConstraintViolation.class));
assertThat(error1.unwrap(ConstraintViolation.class).getPropertyPath().toString(), is("email"));
@ -378,13 +378,13 @@ public class SpringValidatorAdapterTests { @@ -378,13 +378,13 @@ public class SpringValidatorAdapterTests {
private Integer id;
@javax.validation.constraints.NotNull
@NotNull
private String name;
@javax.validation.constraints.NotNull
@NotNull
private Integer age;
@javax.validation.constraints.NotNull
@NotNull
private Parent parent;
public Integer getId() {

2
spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java

@ -429,7 +429,7 @@ public class ValidatorFactoryTests { @@ -429,7 +429,7 @@ public class ValidatorFactoryTests {
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Constraint(validatedBy=InnerValidator.class)
public static @interface InnerValid {
public @interface InnerValid {
String message() default "NOT VALID";

5
spring-expression/src/main/java/org/springframework/expression/spel/ast/OpEQ.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,8 +43,7 @@ public class OpEQ extends Operator { @@ -43,8 +43,7 @@ public class OpEQ extends Operator {
Object right = getRightOperand().getValueInternal(state).getValue();
this.leftActualDescriptor = CodeFlow.toDescriptorFromObject(left);
this.rightActualDescriptor = CodeFlow.toDescriptorFromObject(right);
return BooleanTypedValue.forValue(
equalityCheck(state.getEvaluationContext(), left, right));
return BooleanTypedValue.forValue(equalityCheck(state.getEvaluationContext(), left, right));
}
// This check is different to the one in the other numeric operators (OpLt/etc)

Loading…
Cancel
Save