88import org .junit .jupiter .api .Test ;
99import org .springframework .beans .factory .annotation .Autowired ;
1010import org .springframework .http .HttpHeaders ;
11+ import org .springframework .security .core .context .SecurityContextHolder ;
12+ import org .springframework .security .test .context .support .WithUserDetails ;
13+ import org .springframework .test .annotation .DirtiesContext ;
14+ import org .springframework .test .annotation .DirtiesContext .MethodMode ;
1115import org .springframework .test .context .jdbc .Sql ;
1216import org .springframework .test .context .jdbc .Sql .ExecutionPhase ;
1317import org .springframework .test .web .servlet .MvcResult ;
2529import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
2630import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
2731
32+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
2833@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/truncateTables.sql" )
2934@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepDefaultData.sql" )
3035@ Sql (executionPhase = ExecutionPhase .BEFORE_TEST_METHOD , scripts = "classpath:sql/prepClanData.sql" )
@@ -110,6 +115,7 @@ public void createClanWithoutAuth() throws Exception {
110115 }
111116
112117 @ Test
118+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
113119 public void createClanWithExistingName () throws Exception {
114120 Player player = playerRepository .getById (USERID_USER );
115121
@@ -132,6 +138,7 @@ public void createClanWithExistingName() throws Exception {
132138 }
133139
134140 @ Test
141+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
135142 public void createClanWithExistingTag () throws Exception {
136143 Player player = playerRepository .getById (USERID_USER );
137144
@@ -154,6 +161,7 @@ public void createClanWithExistingTag() throws Exception {
154161 }
155162
156163 @ Test
164+ @ DirtiesContext (methodMode = MethodMode .BEFORE_METHOD )
157165 public void createSecondClan () throws Exception {
158166 Player player = playerRepository .getById (USERID_CLAN_MEMBER );
159167
0 commit comments