Skip to content

Commit c773104

Browse files
committed
faf-java-api-362 Use dirties context for clan tests
1 parent 8d904e3 commit c773104

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/inttest/java/com/faforever/api/clan/ClanControllerTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
import org.junit.jupiter.api.Test;
99
import org.springframework.beans.factory.annotation.Autowired;
1010
import 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;
1115
import org.springframework.test.context.jdbc.Sql;
1216
import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
1317
import org.springframework.test.web.servlet.MvcResult;
@@ -25,6 +29,7 @@
2529
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
2630
import 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

Comments
 (0)