Make tests a little more bullet-proof.

This commit is contained in:
Gary Gregory 2017-10-09 14:52:43 -06:00
parent 0726ffe1e9
commit 87eff4c78f
1 changed files with 6 additions and 2 deletions

View File

@ -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