1
- import org .junit .jupiter .api .Test ;
2
1
import org .junit .jupiter .api .Disabled ;
2
+ import org .junit .jupiter .api .DisplayName ;
3
+ import org .junit .jupiter .api .Test ;
3
4
4
5
import static org .assertj .core .api .Assertions .*;
5
6
@@ -8,102 +9,120 @@ public class SayTest {
8
9
private Say say = new Say ();
9
10
10
11
@ Test
12
+ @ DisplayName ("zero" )
11
13
public void zero () {
12
14
assertThat (say .say (0 )).isEqualTo ("zero" );
13
15
}
14
16
15
17
@ Disabled ("Remove to run test" )
16
18
@ Test
19
+ @ DisplayName ("one" )
17
20
public void one () {
18
21
assertThat (say .say (1 )).isEqualTo ("one" );
19
22
}
20
23
21
24
@ Disabled ("Remove to run test" )
22
25
@ Test
26
+ @ DisplayName ("fourteen" )
23
27
public void fourteen () {
24
28
assertThat (say .say (14 )).isEqualTo ("fourteen" );
25
29
}
26
30
27
31
@ Disabled ("Remove to run test" )
28
32
@ Test
33
+ @ DisplayName ("twenty" )
29
34
public void twenty () {
30
35
assertThat (say .say (20 )).isEqualTo ("twenty" );
31
36
}
32
37
33
38
@ Disabled ("Remove to run test" )
34
39
@ Test
40
+ @ DisplayName ("twenty-two" )
35
41
public void twentyTwo () {
36
42
assertThat (say .say (22 )).isEqualTo ("twenty-two" );
37
43
}
38
44
39
45
@ Disabled ("Remove to run test" )
40
46
@ Test
47
+ @ DisplayName ("thirty" )
41
48
public void thirty () {
42
49
assertThat (say .say (30 )).isEqualTo ("thirty" );
43
50
}
44
51
45
52
@ Disabled ("Remove to run test" )
46
53
@ Test
54
+ @ DisplayName ("ninety-nine" )
47
55
public void ninetyNine () {
48
56
assertThat (say .say (99 )).isEqualTo ("ninety-nine" );
49
57
}
50
58
51
59
@ Disabled ("Remove to run test" )
52
60
@ Test
61
+ @ DisplayName ("one hundred" )
53
62
public void oneHundred () {
54
63
assertThat (say .say (100 )).isEqualTo ("one hundred" );
55
64
}
56
65
57
66
@ Disabled ("Remove to run test" )
58
67
@ Test
68
+ @ DisplayName ("one hundred twenty-three" )
59
69
public void oneHundredTwentyThree () {
60
70
assertThat (say .say (123 )).isEqualTo ("one hundred twenty-three" );
61
71
}
62
72
63
73
@ Disabled ("Remove to run test" )
64
74
@ Test
75
+ @ DisplayName ("two hundred" )
65
76
public void twoHundred () {
66
77
assertThat (say .say (200 )).isEqualTo ("two hundred" );
67
78
}
68
79
69
80
@ Disabled ("Remove to run test" )
70
81
@ Test
82
+ @ DisplayName ("nine hundred ninety-nine" )
71
83
public void nineHundredNinetyNine () {
72
84
assertThat (say .say (999 )).isEqualTo ("nine hundred ninety-nine" );
73
85
}
74
86
75
87
@ Disabled ("Remove to run test" )
76
88
@ Test
89
+ @ DisplayName ("one thousand" )
77
90
public void oneThousand () {
78
91
assertThat (say .say (1_000 )).isEqualTo ("one thousand" );
79
92
}
80
93
81
94
@ Disabled ("Remove to run test" )
82
95
@ Test
96
+ @ DisplayName ("one thousand two hundred thirty-four" )
83
97
public void oneThousandTwoHundredThirtyFour () {
84
98
assertThat (say .say (1_234 )).isEqualTo ("one thousand two hundred thirty-four" );
85
99
}
86
100
87
101
@ Disabled ("Remove to run test" )
88
102
@ Test
103
+ @ DisplayName ("one million" )
89
104
public void oneMillion () {
90
105
assertThat (say .say (1_000_000 )).isEqualTo ("one million" );
91
106
}
92
107
93
108
@ Disabled ("Remove to run test" )
94
109
@ Test
110
+ @ DisplayName ("one million two thousand three hundred forty-five" )
95
111
public void oneMillionTwoThousandThreeHundredFortyFive () {
96
112
assertThat (say .say (1_002_345 )).isEqualTo ("one million two thousand three hundred forty-five" );
97
113
}
98
114
99
115
@ Disabled ("Remove to run test" )
100
116
@ Test
117
+ @ DisplayName ("one billion" )
101
118
public void oneBillion () {
102
119
assertThat (say .say (1_000_000_000 )).isEqualTo ("one billion" );
103
120
}
104
121
105
122
@ Disabled ("Remove to run test" )
106
123
@ Test
124
+ @ DisplayName ("nine hundred eighty-seven billion six hundred " +
125
+ "fifty-four\n million three hundred twenty-one thousand one hundred twenty-three" )
107
126
public void nineHundredEightySevenBillionSixHundredFiftyFourThreeHundredTwentyOneThousandOneHundredTwentyThree () {
108
127
assertThat (say .say (987_654_321_123L ))
109
128
.isEqualTo ("nine hundred eighty-seven billion six hundred fifty-four million" +
@@ -112,13 +131,15 @@ public void nineHundredEightySevenBillionSixHundredFiftyFourThreeHundredTwentyOn
112
131
113
132
@ Disabled ("Remove to run test" )
114
133
@ Test
134
+ @ DisplayName ("numbers below zero are out of range" )
115
135
public void illegalNegativeNumber () {
116
136
assertThatExceptionOfType (IllegalArgumentException .class )
117
137
.isThrownBy (() -> say .say (-1 ));
118
138
}
119
139
120
140
@ Disabled ("Remove to run test" )
121
141
@ Test
142
+ @ DisplayName ("numbers above 999,999,999,999 are out of range" )
122
143
public void illegalTooBigNumber () {
123
144
assertThatExceptionOfType (IllegalArgumentException .class )
124
145
.isThrownBy (() -> say .say (1_000_000_000_000L ));
0 commit comments