Split up test method into smaller ones. Correct code formatting
This commit is contained in:
parent
5cfe661c8a
commit
3396e92d2d
|
@ -10,23 +10,15 @@ public class FormatNumberUnitTest {
|
|||
private static final double F = 8.6994540927d;
|
||||
|
||||
@Test
|
||||
public void givenDecimalNumber_whenFormatNumberToNDecimalPlaces_thenGetExpectedResult() {
|
||||
|
||||
public void givenDecimalNumber_whenFormatNumber_withBigDecimal_thenGetExpectedResult() {
|
||||
assertThat(withBigDecimal(D, 2)).isEqualTo(4.24);
|
||||
assertThat(withBigDecimal(D, 3)).isEqualTo(4.235);
|
||||
assertThat(withBigDecimal(F, 2)).isEqualTo(8.7);
|
||||
assertThat(withBigDecimal(F, 3)).isEqualTo(8.699);
|
||||
}
|
||||
|
||||
assertThat(withMathRound(D, 2)).isEqualTo(4.24);
|
||||
assertThat(withMathRound(D, 3)).isEqualTo(4.235);
|
||||
assertThat(withMathRound(F, 2)).isEqualTo(8.7);
|
||||
assertThat(withMathRound(F, 3)).isEqualTo(8.699);
|
||||
|
||||
assertThat(withStringFormat(D, 2)).isEqualTo("4.24");
|
||||
assertThat(withStringFormat(D, 3)).isEqualTo("4.235");
|
||||
assertThat(withStringFormat(F, 2)).isEqualTo("8.70");
|
||||
assertThat(withStringFormat(F, 3)).isEqualTo("8.699");
|
||||
|
||||
@Test
|
||||
public void givenDecimalNumber_whenFormatNumber_withDecimalFormat_thenGetExpectedResult() {
|
||||
assertThat(withDecimalFormatLocal(D)).isEqualTo(4.235);
|
||||
assertThat(withDecimalFormatLocal(F)).isEqualTo(8.699);
|
||||
|
||||
|
@ -35,4 +27,20 @@ public class FormatNumberUnitTest {
|
|||
assertThat(withDecimalFormatPattern(F, 2)).isEqualTo(8.7);
|
||||
assertThat(withDecimalFormatPattern(F, 3)).isEqualTo(8.699);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDecimalNumber_whenFormatNumber_withStringFormat_thenGetExpectedResult() {
|
||||
assertThat(withStringFormat(D, 2)).isEqualTo("4.24");
|
||||
assertThat(withStringFormat(D, 3)).isEqualTo("4.235");
|
||||
assertThat(withStringFormat(F, 2)).isEqualTo("8.70");
|
||||
assertThat(withStringFormat(F, 3)).isEqualTo("8.699");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDecimalNumber_whenFormatNumber_withMathRound_thenGetExpectedResult() {
|
||||
assertThat(withMathRound(D, 2)).isEqualTo(4.24);
|
||||
assertThat(withMathRound(D, 3)).isEqualTo(4.235);
|
||||
assertThat(withMathRound(F, 2)).isEqualTo(8.7);
|
||||
assertThat(withMathRound(F, 3)).isEqualTo(8.699);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue