Skip to content

Commit ffff903

Browse files
committed
faf-java-api-362 Use dirties context for clan tests
1 parent 2dff99a commit ffff903

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import org.springframework.http.HttpHeaders;
1212
import org.springframework.security.core.context.SecurityContextHolder;
1313
import org.springframework.security.test.context.support.WithUserDetails;
14+
import org.springframework.test.annotation.DirtiesContext;
15+
import org.springframework.test.annotation.DirtiesContext.MethodMode;
1416
import org.springframework.test.context.jdbc.Sql;
1517
import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
1618
import org.springframework.test.web.servlet.MvcResult;
@@ -28,6 +30,7 @@
2830
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
2931
import 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

Comments
 (0)