11
11
import org .springframework .http .HttpHeaders ;
12
12
import org .springframework .security .core .context .SecurityContextHolder ;
13
13
import org .springframework .security .test .context .support .WithUserDetails ;
14
+ import org .springframework .test .annotation .DirtiesContext ;
15
+ import org .springframework .test .annotation .DirtiesContext .MethodMode ;
14
16
import org .springframework .test .context .jdbc .Sql ;
15
17
import org .springframework .test .context .jdbc .Sql .ExecutionPhase ;
16
18
import org .springframework .test .web .servlet .MvcResult ;
28
30
import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
29
31
import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
30
32
33
+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
31
34
@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/truncateTables.sql" )
32
35
@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepDefaultData.sql" )
33
36
@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepClanData.sql" )
@@ -117,6 +120,7 @@ public void createClanWithoutAuth() throws Exception {
117
120
}
118
121
119
122
@ Test
123
+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
120
124
@ WithUserDetails (AUTH_USER )
121
125
public void createClanWithExistingName () throws Exception {
122
126
Player player = getPlayer ();
@@ -139,6 +143,7 @@ public void createClanWithExistingName() throws Exception {
139
143
}
140
144
141
145
@ Test
146
+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
142
147
@ WithUserDetails (AUTH_USER )
143
148
public void createClanWithExistingTag () throws Exception {
144
149
Player player = getPlayer ();
@@ -161,6 +166,7 @@ public void createClanWithExistingTag() throws Exception {
161
166
}
162
167
163
168
@ Test
169
+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
164
170
@ WithUserDetails (AUTH_CLAN_MEMBER )
165
171
public void createSecondClan () throws Exception {
166
172
Player player = getPlayer ();
0 commit comments