Avoid Sharing Contexts between Log Tests
This commit is contained in:
parent
6e1846d8fa
commit
a22c59b403
|
@ -1,7 +1,5 @@
|
|||
package com.baeldung.testloglevel;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -13,9 +11,14 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS;
|
||||
|
||||
@DirtiesContext(classMode = AFTER_CLASS)
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = TestLogLevelApplication.class)
|
||||
@EnableAutoConfiguration(exclude = SecurityAutoConfiguration.class)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.baeldung.testloglevel;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -13,9 +11,14 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS;
|
||||
|
||||
@DirtiesContext(classMode = AFTER_CLASS)
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = TestLogLevelApplication.class)
|
||||
@EnableAutoConfiguration(exclude = SecurityAutoConfiguration.class)
|
||||
|
|
|
@ -11,12 +11,15 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@DirtiesContext(classMode = AFTER_CLASS)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = TestLogLevelApplication.class)
|
||||
@EnableAutoConfiguration(exclude = SecurityAutoConfiguration.class)
|
||||
@ActiveProfiles("logging-test")
|
||||
|
|
Loading…
Reference in New Issue