Details
-
Improvement
-
Resolution: Fixed
-
Trivial - P5
-
3.0.0
-
None
Description
Hello,
ServerDescriptionTest.testShortDescription() failed due to character used for decimal separator :
expected = roundTripTime=5000.0 ms
actual = 5000,0 ms
In my region, locale decimal separator is ',' and not '.'.
org.junit.ComparisonFailure: expected:<..., roundTripTime=5000[.]0 ms, state=CONNECTE...> but was:<..., roundTripTime=5000[,]0 ms, state=CONNECTE...>
|
at org.junit.Assert.assertEquals(Assert.java:115)
|
at org.junit.Assert.assertEquals(Assert.java:144)
|
at com.mongodb.connection.ServerDescriptionTest.testShortDescription(ServerDescriptionTest.java:316)
|
|
More details :
https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html
https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormatSymbols.html
I have fixed this issue by using a locale decimal separator instead of '.'
I will do a pull request.
public void testShortDescription() throws UnknownHostException { |
final char decimalSeparator = new DecimalFormatSymbols().getDecimalSeparator(); |
assertEquals("{address=127.0.0.1:27017, type=UNKNOWN, TagSet{[Tag{name='dc', value='ny'}, Tag{name='rack', value='1'}]}, " |
+ "roundTripTime=5000" + decimalSeparator + "0 ms, " |
|
|
}
|
Farès