-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathMilitaryTimeTest.java
More file actions
156 lines (109 loc) · 3.77 KB
/
MilitaryTimeTest.java
File metadata and controls
156 lines (109 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package io.zipcoder;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class MilitaryTimeTest {
private MilitaryTime militaryTime;
@Before
public void setup() {
militaryTime = new MilitaryTime();
}
@Test
public void formatTest() {
String input = "11:30pm";
String expected = "11:30 PM";
String actual = militaryTime.formatTime(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertNumericallyPMTest() throws Exception{
String input = "1:30pm";
String expected = "13:30";
String actual = militaryTime.convertNumerically(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertNumericallyAMTest() throws Exception {
String input = "1:30am";
String expected = "01:30";
String actual = militaryTime.convertNumerically(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertHoursTest() {
Integer input = 11;
String expected = "Eleven Hundred and ";
String actual = militaryTime.convertHours(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertHoursTest2() {
Integer input = 23;
String expected = "Twenty Three Hundred and ";
String actual = militaryTime.convertHours(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertHoursTest3() {
Integer input = 58;
String expected = "Fifty Eight Hundred and ";
String actual = militaryTime.convertHours(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertHoursTest4() {
Integer input = 3;
String expected = "Zero Three Hundred and ";
String actual = militaryTime.convertHours(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertMinutesTest() {
Integer input = 3;
String expected = "Zero Three Hours";
String actual = militaryTime.convertMinutes(input);
Assert.assertEquals(expected, actual);
}
@Test
public void convertMinutesTest2() {
Integer input = 14;
String expected = "Fourteen Hours";
String actual = militaryTime.convertMinutes(input);
Assert.assertEquals(expected, actual);
}
@Test
public void militaryTimePM() throws Exception {
String input = "1:30pm";
String expected = "Thirteen Hundred and Thirty Hours";
String actual = militaryTime.convertToMilitaryTime(input);
Assert.assertEquals(expected, actual);
}
@Test
public void militaryTimePM2() throws Exception {
String input = "2:22pm";
String expected = "Fourteen Hundred and Twenty Two Hours";
String actual = militaryTime.convertToMilitaryTime(input);
Assert.assertEquals(expected, actual);
}
@Test
public void militaryTimeAM() throws Exception {
String input = "1:30am";
String expected = "Zero One Hundred and Thirty Hours";
String actual = militaryTime.convertToMilitaryTime(input);
Assert.assertEquals(expected, actual);
}
@Test
public void militaryTimeAM2() throws Exception {
String input = "2:11am";
String expected = "Zero Two Hundred and Eleven Hours";
String actual = militaryTime.convertToMilitaryTime(input);
Assert.assertEquals(expected, actual);
}
@Test
public void militaryTimeAM3() throws Exception {
String input = "10:02am";
String expected = "Ten Hundred and Zero Two Hours";
String actual = militaryTime.convertToMilitaryTime(input);
Assert.assertEquals(expected, actual);
}
}