Correct tests
This commit is contained in:
parent
2cb97dbe49
commit
f05224a5a7
|
@ -13,14 +13,14 @@ public class FormatNumberTest {
|
||||||
@Test public void givenDecimalNumber_whenFormatNumberToNDecimalPlaces_thenGetExpectedResult() {
|
@Test public void givenDecimalNumber_whenFormatNumberToNDecimalPlaces_thenGetExpectedResult() {
|
||||||
double delta = 0.0d;
|
double delta = 0.0d;
|
||||||
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withDecimalFormat(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withDecimalFormatPattern(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
||||||
|
|
||||||
places = 3;
|
places = 3;
|
||||||
expected = 2.035d;
|
expected = 2.035d;
|
||||||
|
|
||||||
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withDecimalFormat(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withDecimalFormatPattern(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
||||||
|
|
||||||
value = 256.024d;
|
value = 256.024d;
|
||||||
|
@ -28,7 +28,7 @@ public class FormatNumberTest {
|
||||||
expected = 256.02d;
|
expected = 256.02d;
|
||||||
|
|
||||||
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withDecimalFormat(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withDecimalFormatPattern(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
||||||
|
|
||||||
value = 260.773d;
|
value = 260.773d;
|
||||||
|
@ -36,7 +36,7 @@ public class FormatNumberTest {
|
||||||
expected = 260.77d;
|
expected = 260.77d;
|
||||||
|
|
||||||
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withBigDecimal(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withDecimalFormat(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withDecimalFormatPattern(value, places), delta);
|
||||||
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
Assert.assertEquals(expected, FormatNumber.withMathRound(value, places), delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue