Skip to content

Commit c048f85

Browse files
add displayname annotations to say
1 parent 0a098ef commit c048f85

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

exercises/practice/say/src/test/java/SayTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import org.junit.jupiter.api.Test;
21
import org.junit.jupiter.api.Disabled;
2+
import org.junit.jupiter.api.DisplayName;
3+
import org.junit.jupiter.api.Test;
34

45
import static org.assertj.core.api.Assertions.*;
56

@@ -8,102 +9,120 @@ public class SayTest {
89
private Say say = new Say();
910

1011
@Test
12+
@DisplayName("zero")
1113
public void zero() {
1214
assertThat(say.say(0)).isEqualTo("zero");
1315
}
1416

1517
@Disabled("Remove to run test")
1618
@Test
19+
@DisplayName("one")
1720
public void one() {
1821
assertThat(say.say(1)).isEqualTo("one");
1922
}
2023

2124
@Disabled("Remove to run test")
2225
@Test
26+
@DisplayName("fourteen")
2327
public void fourteen() {
2428
assertThat(say.say(14)).isEqualTo("fourteen");
2529
}
2630

2731
@Disabled("Remove to run test")
2832
@Test
33+
@DisplayName("twenty")
2934
public void twenty() {
3035
assertThat(say.say(20)).isEqualTo("twenty");
3136
}
3237

3338
@Disabled("Remove to run test")
3439
@Test
40+
@DisplayName("twenty-two")
3541
public void twentyTwo() {
3642
assertThat(say.say(22)).isEqualTo("twenty-two");
3743
}
3844

3945
@Disabled("Remove to run test")
4046
@Test
47+
@DisplayName("thirty")
4148
public void thirty() {
4249
assertThat(say.say(30)).isEqualTo("thirty");
4350
}
4451

4552
@Disabled("Remove to run test")
4653
@Test
54+
@DisplayName("ninety-nine")
4755
public void ninetyNine() {
4856
assertThat(say.say(99)).isEqualTo("ninety-nine");
4957
}
5058

5159
@Disabled("Remove to run test")
5260
@Test
61+
@DisplayName("one hundred")
5362
public void oneHundred() {
5463
assertThat(say.say(100)).isEqualTo("one hundred");
5564
}
5665

5766
@Disabled("Remove to run test")
5867
@Test
68+
@DisplayName("one hundred twenty-three")
5969
public void oneHundredTwentyThree() {
6070
assertThat(say.say(123)).isEqualTo("one hundred twenty-three");
6171
}
6272

6373
@Disabled("Remove to run test")
6474
@Test
75+
@DisplayName("two hundred")
6576
public void twoHundred() {
6677
assertThat(say.say(200)).isEqualTo("two hundred");
6778
}
6879

6980
@Disabled("Remove to run test")
7081
@Test
82+
@DisplayName("nine hundred ninety-nine")
7183
public void nineHundredNinetyNine() {
7284
assertThat(say.say(999)).isEqualTo("nine hundred ninety-nine");
7385
}
7486

7587
@Disabled("Remove to run test")
7688
@Test
89+
@DisplayName("one thousand")
7790
public void oneThousand() {
7891
assertThat(say.say(1_000)).isEqualTo("one thousand");
7992
}
8093

8194
@Disabled("Remove to run test")
8295
@Test
96+
@DisplayName("one thousand two hundred thirty-four")
8397
public void oneThousandTwoHundredThirtyFour() {
8498
assertThat(say.say(1_234)).isEqualTo("one thousand two hundred thirty-four");
8599
}
86100

87101
@Disabled("Remove to run test")
88102
@Test
103+
@DisplayName("one million")
89104
public void oneMillion() {
90105
assertThat(say.say(1_000_000)).isEqualTo("one million");
91106
}
92107

93108
@Disabled("Remove to run test")
94109
@Test
110+
@DisplayName("one million two thousand three hundred forty-five")
95111
public void oneMillionTwoThousandThreeHundredFortyFive() {
96112
assertThat(say.say(1_002_345)).isEqualTo("one million two thousand three hundred forty-five");
97113
}
98114

99115
@Disabled("Remove to run test")
100116
@Test
117+
@DisplayName("one billion")
101118
public void oneBillion() {
102119
assertThat(say.say(1_000_000_000)).isEqualTo("one billion");
103120
}
104121

105122
@Disabled("Remove to run test")
106123
@Test
124+
@DisplayName("nine hundred eighty-seven billion six hundred " +
125+
"fifty-four\nmillion three hundred twenty-one thousand one hundred twenty-three")
107126
public void nineHundredEightySevenBillionSixHundredFiftyFourThreeHundredTwentyOneThousandOneHundredTwentyThree() {
108127
assertThat(say.say(987_654_321_123L))
109128
.isEqualTo("nine hundred eighty-seven billion six hundred fifty-four million" +
@@ -112,13 +131,15 @@ public void nineHundredEightySevenBillionSixHundredFiftyFourThreeHundredTwentyOn
112131

113132
@Disabled("Remove to run test")
114133
@Test
134+
@DisplayName("numbers below zero are out of range")
115135
public void illegalNegativeNumber() {
116136
assertThatExceptionOfType(IllegalArgumentException.class)
117137
.isThrownBy(() -> say.say(-1));
118138
}
119139

120140
@Disabled("Remove to run test")
121141
@Test
142+
@DisplayName("numbers above 999,999,999,999 are out of range")
122143
public void illegalTooBigNumber() {
123144
assertThatExceptionOfType(IllegalArgumentException.class)
124145
.isThrownBy(() -> say.say(1_000_000_000_000L));

0 commit comments

Comments
 (0)