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 Jun 2, 2023
1 parent 8d904e3 commit c773104
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
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 @@ -25,6 +29,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 @@ -110,6 +115,7 @@ public void createClanWithoutAuth() throws Exception {
}

@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
public void createClanWithExistingName() throws Exception {
Player player = playerRepository.getById(USERID_USER);

Expand All @@ -132,6 +138,7 @@ public void createClanWithExistingName() throws Exception {
}

@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
public void createClanWithExistingTag() throws Exception {
Player player = playerRepository.getById(USERID_USER);

Expand All @@ -154,6 +161,7 @@ public void createClanWithExistingTag() throws Exception {
}

@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
public void createSecondClan() throws Exception {
Player player = playerRepository.getById(USERID_CLAN_MEMBER);

Expand Down

0 comments on commit c773104

Please sign in to comment.