Correct test naming

This commit is contained in:
Marcin Krykowski 2020-06-23 09:51:56 +01:00
parent 7b8b442201
commit 8e459cef24
1 changed files with 9 additions and 9 deletions

View File

@ -12,7 +12,7 @@ public class FormatNumberUnitTest {
private static final double F = 8.6994540927d; private static final double F = 8.6994540927d;
@Test @Test
public void givenDecimalNumber_whenFormatNumber_withBigDecimal_thenGetExpectedResult() { public void givenDecimalNumber_whenFormatNumberWithBigDecimal_thenGetExpectedResult() {
assertThat(withBigDecimal(D, 2)).isEqualTo(4.24); assertThat(withBigDecimal(D, 2)).isEqualTo(4.24);
assertThat(withBigDecimal(D, 3)).isEqualTo(4.235); assertThat(withBigDecimal(D, 3)).isEqualTo(4.235);
assertThat(withBigDecimal(F, 2)).isEqualTo(8.7); assertThat(withBigDecimal(F, 2)).isEqualTo(8.7);
@ -20,7 +20,7 @@ public class FormatNumberUnitTest {
} }
@Test @Test
public void givenDecimalNumber_whenFormatNumber_withDecimalFormat_thenGetExpectedResult() { public void givenDecimalNumber_whenFormatNumberWithDecimalFormat_thenGetExpectedResult() {
assertThat(withDecimalFormatLocal(D)).isEqualTo(4.235); assertThat(withDecimalFormatLocal(D)).isEqualTo(4.235);
assertThat(withDecimalFormatLocal(F)).isEqualTo(8.699); assertThat(withDecimalFormatLocal(F)).isEqualTo(8.699);
@ -31,7 +31,7 @@ public class FormatNumberUnitTest {
} }
@Test @Test
public void givenDecimalNumber_whenFormatNumber_withStringFormat_thenGetExpectedResult() { public void givenDecimalNumber_whenFormatNumberWithStringFormat_thenGetExpectedResult() {
assertThat(withStringFormat(D, 2)).isEqualTo("4.24"); assertThat(withStringFormat(D, 2)).isEqualTo("4.24");
assertThat(withStringFormat(D, 3)).isEqualTo("4.235"); assertThat(withStringFormat(D, 3)).isEqualTo("4.235");
assertThat(withStringFormat(F, 2)).isEqualTo("8.70"); assertThat(withStringFormat(F, 2)).isEqualTo("8.70");
@ -39,7 +39,7 @@ public class FormatNumberUnitTest {
} }
@Test @Test
public void givenDecimalNumber_whenFormatNumber_withMathRound_thenGetExpectedResult() { public void givenDecimalNumber_whenFormatNumberWithMathRound_thenGetExpectedResult() {
assertThat(withMathRound(D, 2)).isEqualTo(4.24); assertThat(withMathRound(D, 2)).isEqualTo(4.24);
assertThat(withMathRound(D, 3)).isEqualTo(4.235); assertThat(withMathRound(D, 3)).isEqualTo(4.235);
assertThat(withMathRound(F, 2)).isEqualTo(8.7); assertThat(withMathRound(F, 2)).isEqualTo(8.7);
@ -47,32 +47,32 @@ public class FormatNumberUnitTest {
} }
@Test @Test
public void givenIntegerNumber_whenFormatNumber_byPaddingOutZeros_thenGetExpectedResult() { public void givenIntegerNumber_whenFormatNumberByPaddingOutZeros_thenGetExpectedResult() {
int value = 1; int value = 1;
assertThat(byPaddingZeros(value, 3)).isEqualTo("001"); assertThat(byPaddingZeros(value, 3)).isEqualTo("001");
} }
@Test @Test
public void givenIntegerNumber_whenFormatNumber_withTwoDecimalPlaces_thenGetExpectedResult() { public void givenIntegerNumber_whenFormatNumberWithTwoDecimalPlaces_thenGetExpectedResult() {
int value = 12; int value = 12;
assertThat(withTwoDecimalPlaces(value)).isEqualTo(12.00); assertThat(withTwoDecimalPlaces(value)).isEqualTo(12.00);
} }
@Test @Test
public void givenIntegerNumber_whenFormatNumber_withLargeIntegers_thenGetExpectedResult() { public void givenIntegerNumber_whenFormatNumberWithLargeIntegers_thenGetExpectedResult() {
int value = 123456789; int value = 123456789;
assertThat(withLargeIntegers(value)).isEqualTo("123,456,789"); assertThat(withLargeIntegers(value)).isEqualTo("123,456,789");
} }
@Test @Test
public void givenDecimalNumber_whenFormatNumber_forPercentages_thenGetExpectedResult() { public void givenDecimalNumber_whenFormatNumberForPercentages_thenGetExpectedResult() {
double value = 25f / 100f; double value = 25f / 100f;
assertThat(forPercentages(value, new Locale("en", "US"))).isEqualTo("25%"); assertThat(forPercentages(value, new Locale("en", "US"))).isEqualTo("25%");
assertThat(forPercentages(value, new Locale("pl", "PL"))).isEqualTo("25%"); assertThat(forPercentages(value, new Locale("pl", "PL"))).isEqualTo("25%");
} }
@Test @Test
public void givenCurrency_whenFormatNumber_currencyWithChosenLocalisation_thenGetExpectedResult() { public void givenCurrency_whenFormatNumberCurrencyWithChosenLocalisation_thenGetExpectedResult() {
double value = 23_500; double value = 23_500;
assertThat(currencyWithChosenLocalisation(value, new Locale("en", "US"))).isEqualTo("$23,500.00"); assertThat(currencyWithChosenLocalisation(value, new Locale("en", "US"))).isEqualTo("$23,500.00");
assertThat(currencyWithChosenLocalisation(value, new Locale("zh", "CN"))).isEqualTo("¥23,500.00"); assertThat(currencyWithChosenLocalisation(value, new Locale("zh", "CN"))).isEqualTo("¥23,500.00");