Skip to content
Snippets Groups Projects
Commit a351feac authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #740 - fixed floating point handling

parent 8928ecb8
No related branches found
No related tags found
2 merge requests!239V2 15 0,!238V2 15 0
......@@ -49,7 +49,7 @@ public class AmountParser
throw new ParseException("String not fully parsed", parsePosition.getIndex());
}
return Optional.of((int) (parseDouble * 100));
return Optional.of((int) Math.round(parseDouble * 100));
}
catch(ParseException e)
{
......
......@@ -268,4 +268,12 @@ class AmountParserTest
.isPresent()
.get().isEqualTo(-123456703);
}
@Test
void test_floatingPoint()
{
assertThat(AmountParser.parse("-9,7 €", ',', '.'))
.isPresent()
.get().isEqualTo(-970);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment