review updates

This commit is contained in:
Krzysztof Majewski 2019-09-17 09:07:47 +02:00
parent e48b29d58c
commit b3b7e78ce6
2 changed files with 9 additions and 8 deletions

View File

@ -17,12 +17,13 @@ public class MyMessageInterpolator implements MessageInterpolator {
@Override @Override
public String interpolate(String messageTemplate, Context context) { public String interpolate(String messageTemplate, Context context) {
logger.debug("Selecting the language " + Locale.getDefault() + " for the error message."); messageTemplate = messageTemplate.toUpperCase();
return defaultInterpolator.interpolate(messageTemplate, context, Locale.getDefault()); return defaultInterpolator.interpolate(messageTemplate, context, Locale.getDefault());
} }
@Override @Override
public String interpolate(String messageTemplate, Context context, Locale locale) { public String interpolate(String messageTemplate, Context context, Locale locale) {
messageTemplate = messageTemplate.toUpperCase();
return defaultInterpolator.interpolate(messageTemplate, context, locale); return defaultInterpolator.interpolate(messageTemplate, context, locale);
} }
} }

View File

@ -10,21 +10,21 @@ public class ValidationExamples {
private static final Formatter formatter = new Formatter(); private static final Formatter formatter = new Formatter();
@Size( @Size(
min = 5, min = 5,
max = 14, max = 14,
message = "The author email '${validatedValue}' must be between {min} and {max} characters long" message = "The author email '${validatedValue}' must be between {min} and {max} characters long"
) )
private String authorEmail; private String authorEmail;
@Min( @Min(
value = 1, value = 1,
message = "There must be at least {value} test{value > 1 ? 's' : ''} int the test case" message = "There must be at least {value} test{value > 1 ? 's' : ''} int the test case"
) )
private int testCount; private int testCount;
@DecimalMin( @DecimalMin(
value = "50", value = "50",
message = "The code coverage ${formatter.format('%1$.2f', validatedValue)} must be higher than {value}%" message = "The code coverage ${formatter.format('%1$.2f', validatedValue)} must be higher than {value}%"
) )
private double codeCoverage; private double codeCoverage;