make sure the test runs correctly even in a non-US environment

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1091153 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2011-04-11 18:02:52 +00:00
parent f69fd48e53
commit 402279e151
1 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@
package org.apache.commons.math.exception;
import java.text.MessageFormat;
import java.util.Locale;
import org.junit.Assert;
import org.junit.Test;
@ -32,9 +33,12 @@ public class TooManyEvaluationsExceptionTest {
final int max = 12345;
final TooManyEvaluationsException e = new TooManyEvaluationsException(max);
final String msg = e.getMessage();
final MessageFormat usFormat = new MessageFormat("{0}", Locale.US);
Assert.assertTrue(msg,
msg.matches(".*?" +
MessageFormat.format("{0}", max) +
usFormat.format(new Object[] {max},
new StringBuffer(),
null) +
".*"));
}
}