Skip to content

Commit 1c97c62

Browse files
committed
Fixed #126
1 parent f73734a commit 1c97c62

File tree

3 files changed

+123
-8
lines changed

3 files changed

+123
-8
lines changed

etc/TODO.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,5 @@ Fixed #122, Fixed #123, Fixed #127, Fixed #130, Fixed #152, Fixed #153, Fixed #1
9090

9191
Fixed #129
9292
Fixed #126
93+
94+
https://developer.okta.com/blog/2019/03/28/test-java-spring-boot-junit5

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@
379379
<artifactId>spring-boot-starter-test</artifactId>
380380
<scope>test</scope>
381381
<exclusions>
382+
<exclusion>
383+
<groupId>junit</groupId>
384+
<artifactId>junit</artifactId>
385+
</exclusion>
382386
<exclusion>
383387
<groupId>org.junit.vintage</groupId>
384388
<artifactId>junit-vintage-engine</artifactId>

src/test/java/org/woehlke/simpleworklist/SmokeTests.java

Lines changed: 117 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
package org.woehlke.simpleworklist;
22

33
import lombok.extern.slf4j.Slf4j;
4-
import org.junit.jupiter.api.BeforeEach;
5-
import org.junit.jupiter.api.Test;
4+
import org.junit.jupiter.api.*;
65
import org.springframework.beans.factory.annotation.Autowired;
76
import org.springframework.boot.test.context.SpringBootTest;
87
import org.springframework.boot.web.server.LocalServerPort;
98
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
109
import org.springframework.security.core.context.SecurityContextHolder;
11-
import org.springframework.test.context.event.annotation.AfterTestClass;
12-
import org.springframework.test.context.event.annotation.BeforeTestClass;
1310
import org.springframework.test.web.servlet.MockMvc;
1411
import org.springframework.web.context.WebApplicationContext;
1512
import org.woehlke.simpleworklist.config.UserAccountTestDataService;
1613

1714
import java.net.URL;
1815

16+
import static org.junit.jupiter.api.Assertions.assertTrue;
1917
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
2018

2119
@Slf4j
20+
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
21+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2222
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
2323
public class SmokeTests {
2424

@@ -38,158 +38,267 @@ public class SmokeTests {
3838
@Autowired
3939
private UserAccountTestDataService userAccountTestDataService;
4040

41+
42+
private final String eyecatcherH1 = "##################################################################";
43+
private final String eyecatcherH2 = "------------------------------------------------------------------";
44+
private final String eyecatcherH3 = "******************************************************************";
45+
4146
@BeforeEach
4247
public void setUp() throws Exception {
48+
log.info(eyecatcherH1);
4349
log.info(" @BeforeEach setUp()");
50+
log.info(eyecatcherH2);
4451
this.base = new URL("http://localhost:" + port + "/");
4552
this.mockMvc = webAppContextSetup(wac).build();
46-
userAccountTestDataService.setUp();
53+
log.info(" Server URL: "+this.base.toString());
54+
//userAccountTestDataService.setUp();
55+
log.info(eyecatcherH1);
4756
}
4857

49-
@BeforeTestClass
58+
@BeforeAll
5059
public void runBeforeTestClass() throws Exception {
60+
log.info(eyecatcherH1);
61+
log.info(" @BeforeTestClass runBeforeTestClass");
62+
log.info(eyecatcherH2);
63+
this.base = new URL("http://localhost:" + port + "/");
64+
this.mockMvc = webAppContextSetup(wac).build();
65+
log.info(" Server URL: "+this.base.toString());
66+
log.info(eyecatcherH2);
67+
userAccountTestDataService.setUp();
68+
log.info(eyecatcherH2);
5169
log.info(" @BeforeTestClass runBeforeTestClass");
70+
log.info(eyecatcherH1);
5271
}
5372

54-
@AfterTestClass
73+
@AfterAll
5574
public void runAfterTestClass() {
75+
log.info(eyecatcherH1);
5676
log.info(" @AfterTestClass clearContext");
77+
log.info(eyecatcherH2);
5778
SecurityContextHolder.clearContext();
79+
log.info(eyecatcherH1);
5880
}
5981

82+
83+
@DisplayName("Test Mock helloService + helloRepository")
84+
@Order(1)
6085
@Test
6186
public void testF001ServerStarts(){
87+
log.info(eyecatcherH1);
6288
log.info("testF001ServerStarts");
89+
log.info(eyecatcherH2);
90+
log.info("Server URL: "+this.base.toString());
91+
assertTrue(true);
92+
log.info(eyecatcherH2);
6393
}
6494

95+
@Order(2)
6596
@Test
6697
public void testF002HomePageRendered(){
98+
log.info(eyecatcherH1);
6799
log.info("testF002HomePageRendered");
100+
log.info(eyecatcherH2);
101+
log.info(eyecatcherH2);
68102
}
69103

104+
@Order(3)
70105
@Test
71106
public void testF003Registration(){
107+
log.info(eyecatcherH1);
72108
log.info("testF003Registration");
109+
log.info(eyecatcherH2);
73110
}
74111

112+
@Order(4)
75113
@Test
76114
public void testF004PasswordRecovery(){
115+
log.info(eyecatcherH1);
77116
log.info("testF004PasswordRecovery");
117+
log.info(eyecatcherH2);
78118
}
79119

120+
@Order(5)
80121
@Test
81122
public void testF005Login(){
123+
log.info(eyecatcherH1);
82124
log.info("testF005Login");
125+
log.info(eyecatcherH2);
83126
}
84127

128+
@Order(6)
85129
@Test
86130
public void testF006PageAfterFirstSuccessfulLogin(){
131+
log.info(eyecatcherH1);
87132
log.info("testF006PageAfterFirstSuccessfulLogins");
133+
log.info(eyecatcherH2);
88134
}
89135

136+
@Order(7)
90137
@Test
91138
public void testF007AddFirstNewTaskToInbox(){
139+
log.info(eyecatcherH1);
92140
log.info("testF007AddFirstNewTaskToInbox");
141+
log.info(eyecatcherH2);
93142
}
94143

144+
@Order(8)
95145
@Test
96146
public void testF008AddAnotherNewTaskToInbox(){
147+
log.info(eyecatcherH1);
97148
log.info("testF008AddAnotherNewTaskToInbox");
149+
log.info(eyecatcherH2);
98150
}
99151

152+
@Order(9)
100153
@Test
101154
public void testF009AddTaskToProjectRoot(){
155+
log.info(eyecatcherH1);
102156
log.info("testF009AddTaskToProjectRoot");
157+
log.info(eyecatcherH2);
103158
}
159+
160+
@Order(10)
104161
@Test
105162
public void testF010AddSubProjectToProjectRoot(){
163+
log.info(eyecatcherH1);
106164
log.info("testF010AddSubProjectToProjectRoot");
165+
log.info(eyecatcherH2);
107166
}
108167

168+
@Order(11)
109169
@Test
110170
public void testF011SetFocusOfTask(){
171+
log.info(eyecatcherH1);
111172
log.info("testF011SetFocusOfTask");
173+
log.info(eyecatcherH2);
112174
}
113175

176+
@Order(12)
114177
@Test
115178
public void testF012UnSetFocusOfTask(){
179+
log.info(eyecatcherH1);
116180
log.info("testF012UnSetFocusOfTask");
181+
log.info(eyecatcherH2);
117182
}
118183

184+
@Order(13)
119185
@Test
120186
public void testF013ShowTaskstateInbox(){
187+
log.info(eyecatcherH1);
121188
log.info("testF013ShowTaskstateInbox");
189+
log.info(eyecatcherH2);
122190
}
123191

192+
@Order(14)
124193
@Test
125194
public void testF014ShowTaskstateToday(){
195+
log.info(eyecatcherH1);
126196
log.info("testF014ShowTaskstateToday");
197+
log.info(eyecatcherH2);
127198
}
128199

200+
@Order(15)
129201
@Test
130202
public void testF015ShowTaskstateNext(){
203+
log.info(eyecatcherH1);
131204
log.info("testF015ShowTaskstateNext");
205+
log.info(eyecatcherH2);
132206
}
133207

208+
@Order(16)
134209
@Test
135210
public void testF016ShowTaskstateWaiting(){
211+
log.info(eyecatcherH1);
136212
log.info("testF016ShowTaskstateWaiting");
213+
log.info(eyecatcherH2);
137214
}
138215

216+
@Order(17)
139217
@Test
140218
public void testF017ShowTaskstateScheduled(){
219+
log.info(eyecatcherH1);
141220
log.info("testF017ShowTaskstateScheduled");
221+
log.info(eyecatcherH2);
142222
}
143223

224+
@Order(18)
144225
@Test
145226
public void testF018ShowTaskstateSomeday(){
227+
log.info(eyecatcherH1);
146228
log.info("testF018ShowTaskstateSomeday");
229+
log.info(eyecatcherH2);
147230
}
148231

232+
@Order(19)
149233
@Test
150234
public void testF019ShowTaskstateFocus(){
235+
log.info(eyecatcherH1);
151236
log.info("testF019ShowTaskstateFocus");
237+
log.info(eyecatcherH2);
152238
}
153239

240+
@Order(20)
154241
@Test
155242
public void testF020ShowTaskstateCompleted(){
243+
log.info(eyecatcherH1);
156244
log.info("testF020ShowTaskstateCompleted");
245+
log.info(eyecatcherH2);
157246
}
158247

248+
@Order(21)
159249
@Test
160250
public void testF021ShowTaskstateTrash(){
251+
log.info(eyecatcherH1);
161252
log.info("testF021ShowTaskstateTrash");
253+
log.info(eyecatcherH2);
162254
}
163255

256+
@Order(22)
164257
@Test
165258
public void testF022TaskEdit(){
259+
log.info(eyecatcherH1);
166260
log.info("testF022TaskEdit");
261+
log.info(eyecatcherH2);
167262
}
168263

264+
@Order(23)
169265
@Test
170266
public void testF023TaskEditFormChangeTaskstateViaDropDown(){
267+
log.info(eyecatcherH1);
171268
log.info("testF023TaskEditFormChangeTaskstateViaDropDown");
269+
log.info(eyecatcherH2);
172270
}
173271

272+
@Order(24)
174273
@Test
175274
public void testF024TaskComplete(){
275+
log.info(eyecatcherH1);
176276
log.info("testF024TaskComplete");
277+
log.info(eyecatcherH2);
177278
}
178279

280+
@Order(25)
179281
@Test
180282
public void testF025TaskIncomplete(){
283+
log.info(eyecatcherH1);
181284
log.info("testF025TaskIncomplete");
285+
log.info(eyecatcherH2);
182286
}
183287

288+
@Order(26)
184289
@Test
185290
public void testF026TaskDelete(){
291+
log.info(eyecatcherH1);
186292
log.info("testF026TaskDelete");
293+
log.info(eyecatcherH2);
187294
}
188295

296+
@Order(27)
189297
@Test
190298
public void testF027TaskUndelete(){
299+
log.info(eyecatcherH1);
191300
log.info("testF027TaskUndelete");
301+
log.info(eyecatcherH2);
192302
}
193303

194-
195304
}

0 commit comments

Comments
 (0)