From 87eff4c78fac85c1b5f2309887f6be5fa2972537 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 9 Oct 2017 14:52:43 -0600 Subject: [PATCH] Make tests a little more bullet-proof. --- .../commons/lang3/text/ExtendedMessageFormatTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java index fadb4f07c..7e2967c5e 100644 --- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java @@ -138,7 +138,7 @@ public class ExtendedMessageFormatTest { } final StringBuilder expected = new StringBuilder(); expected.append("Name: "); - expected.append(args[0].toString().toUpperCase()); + expected.append(args[0].toString().toUpperCase(Locale.ROOT)); expected.append(" DOB: "); expected.append(df.format(args[1])); expected.append(" Salary: "); @@ -422,8 +422,9 @@ public class ExtendedMessageFormatTest { @Override public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) { - return toAppendTo.append(((String)obj).toUpperCase()); + return toAppendTo.append(((String) obj).toUpperCase(Locale.ROOT)); } + @Override public Object parseObject(final String source, final ParsePosition pos) { throw new UnsupportedOperationException(); @@ -437,6 +438,7 @@ public class ExtendedMessageFormatTest { */ private static class LowerCaseFormatFactory implements FormatFactory { private static final Format LOWER_INSTANCE = new LowerCaseFormat(); + @Override public Format getFormat(final String name, final String arguments, final Locale locale) { return LOWER_INSTANCE; @@ -447,6 +449,7 @@ public class ExtendedMessageFormatTest { */ private static class UpperCaseFormatFactory implements FormatFactory { private static final Format UPPER_INSTANCE = new UpperCaseFormat(); + @Override public Format getFormat(final String name, final String arguments, final Locale locale) { return UPPER_INSTANCE; @@ -456,6 +459,7 @@ public class ExtendedMessageFormatTest { * {@link FormatFactory} implementation to override date format "short" to "default". */ private static class OverrideShortDateFormatFactory implements FormatFactory { + @Override public Format getFormat(final String name, final String arguments, final Locale locale) { return !"short".equals(arguments) ? null