Skip to content

Commit

Permalink
faf-java-api-362 Use dirties context for clan tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bukajsytlos committed Dec 6, 2020
1 parent 2dff99a commit ffff903
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.springframework.http.HttpHeaders;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.test.context.support.WithUserDetails;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.MethodMode;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
import org.springframework.test.web.servlet.MvcResult;
Expand All @@ -28,6 +30,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:sql/truncateTables.sql")
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:sql/prepDefaultData.sql")
@Sql(executionPhase = ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:sql/prepClanData.sql")
Expand Down Expand Up @@ -117,6 +120,7 @@ public void createClanWithoutAuth() throws Exception {
}

@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
@WithUserDetails(AUTH_USER)
public void createClanWithExistingName() throws Exception {
Player player = getPlayer();
Expand All @@ -139,6 +143,7 @@ public void createClanWithExistingName() throws Exception {
}

@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
@WithUserDetails(AUTH_USER)
public void createClanWithExistingTag() throws Exception {
Player player = getPlayer();
Expand All @@ -161,6 +166,7 @@ public void createClanWithExistingTag() throws Exception {
}

@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
@WithUserDetails(AUTH_CLAN_MEMBER)
public void createSecondClan() throws Exception {
Player player = getPlayer();
Expand Down

0 comments on commit ffff903

Please sign in to comment.