My testing of the modules failed with the following error. Is there a way to compare softer ones to pass a test for such problems?
I do not want to specify DecimalFormatter in more detail, but to make the test more forgiving.
junit.framework.ComparisonFailure: expected:<[-]0.31 mm> but was:<[−]0.31 mm>
Security Code
public void testCode() { Locale.setDefault(Locale.US); assertEquals("-0.31 mm", codeUnderTest(-0.000314d); }
If the code generating the string is
private static final int OFFSET_FRACTION_DIGITS_SI = 2; private static final double UNIT_MULTIPLIER_SI = 1000d;
Update:
More testing showed that the Unicode point returned by DecimalFormat is the Unicode character "MINUS SIGN" (U + 2212), and the character specified as expected is the Unicode character "HYPHEN-MINUS" (U + 002D). Therefore, I am looking for a way to match such characters with a single unicode point. The same applies to the thousandth separator, which will be the Unicode character "NO-BREAK SPACE" (U + 00A0) as opposed to the regular Unicode character "SPACE" (U + 0020).
source share