forked from plusone/plusone-validator
fix: 修复双精度数值验证器中的格式化字符串问题
This commit is contained in:
@@ -48,7 +48,7 @@ public class DoublePropertyValidator<T>
|
||||
*/
|
||||
public final DoublePropertyValidator<T> gt(final double min) {
|
||||
return withRule(Conditions.greaterThan(min),
|
||||
"The input must be greater than '%s'.", min);
|
||||
"The input must be greater than '%f'.", min);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ public class DoublePropertyValidator<T>
|
||||
*/
|
||||
public final DoublePropertyValidator<T> ge(final double min) {
|
||||
return withRule(Conditions.greaterThanOrEqualTo(min),
|
||||
"The input must be greater than or equal to '%s'.", min);
|
||||
"The input must be greater than or equal to '%f'.", min);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,7 +162,7 @@ public class DoublePropertyValidator<T>
|
||||
*/
|
||||
public final DoublePropertyValidator<T> lt(final double max) {
|
||||
return withRule(Conditions.lessThan(max),
|
||||
"The input must be less than '%s'.", max);
|
||||
"The input must be less than '%f'.", max);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +219,7 @@ public class DoublePropertyValidator<T>
|
||||
*/
|
||||
public final DoublePropertyValidator<T> le(final double max) {
|
||||
return withRule(Conditions.lessThanOrEqualTo(max),
|
||||
"The input must be less than or equal to '%s'.", max);
|
||||
"The input must be less than or equal to '%f'.", max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DoublePropertyValidatorTests {
|
||||
|
||||
ValidationException e = assertThrows(
|
||||
ValidationException.class, () -> validator.validate(command));
|
||||
assertEquals(String.format("The input must be greater than '%s'.", MIN), e.getMessage());
|
||||
assertEquals(String.format("The input must be greater than '%f'.", MIN), e.getMessage());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@@ -196,7 +196,7 @@ public class DoublePropertyValidatorTests {
|
||||
|
||||
ValidationException e = assertThrows(
|
||||
ValidationException.class, () -> validator.validate(command));
|
||||
assertEquals(String.format("The input must be greater than or equal to '%s'.", MIN), e.getMessage());
|
||||
assertEquals(String.format("The input must be greater than or equal to '%f'.", MIN), e.getMessage());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@@ -305,7 +305,7 @@ public class DoublePropertyValidatorTests {
|
||||
|
||||
ValidationException e = assertThrows(
|
||||
ValidationException.class, () -> validator.validate(command));
|
||||
assertEquals(String.format("The input must be less than '%s'.", MAX), e.getMessage());
|
||||
assertEquals(String.format("The input must be less than '%f'.", MAX), e.getMessage());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@@ -414,7 +414,7 @@ public class DoublePropertyValidatorTests {
|
||||
|
||||
ValidationException e = assertThrows(
|
||||
ValidationException.class, () -> validator.validate(command));
|
||||
assertEquals(String.format("The input must be less than or equal to '%s'.", MAX), e.getMessage());
|
||||
assertEquals(String.format("The input must be less than or equal to '%f'.", MAX), e.getMessage());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
||||
Reference in New Issue
Block a user