1111import org .springframework .http .HttpHeaders ;
1212import org .springframework .security .core .context .SecurityContextHolder ;
1313import org .springframework .security .test .context .support .WithUserDetails ;
14+ import org .springframework .test .annotation .DirtiesContext ;
15+ import org .springframework .test .annotation .DirtiesContext .MethodMode ;
1416import org .springframework .test .context .jdbc .Sql ;
1517import org .springframework .test .context .jdbc .Sql .ExecutionPhase ;
1618import org .springframework .test .web .servlet .MvcResult ;
2830import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
2931import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
3032
33+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
3134@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/truncateTables.sql" )
3235@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepDefaultData.sql" )
3336@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepClanData.sql" )
@@ -117,6 +120,7 @@ public void createClanWithoutAuth() throws Exception {
117120 }
118121
119122 @ Test
123+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
120124 @ WithUserDetails (AUTH_USER )
121125 public void createClanWithExistingName () throws Exception {
122126 Player player = getPlayer ();
@@ -139,6 +143,7 @@ public void createClanWithExistingName() throws Exception {
139143 }
140144
141145 @ Test
146+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
142147 @ WithUserDetails (AUTH_USER )
143148 public void createClanWithExistingTag () throws Exception {
144149 Player player = getPlayer ();
@@ -161,6 +166,7 @@ public void createClanWithExistingTag() throws Exception {
161166 }
162167
163168 @ Test
169+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
164170 @ WithUserDetails (AUTH_CLAN_MEMBER )
165171 public void createSecondClan () throws Exception {
166172 Player player = getPlayer ();
0 commit comments