BAEL-9496 Fix failing context tests (#7855)

* BAEL-9496 Fix failing context tests

- Fixes for SpringContextIntegrationTest in several projects

* BAEL-9496 Fix failing context tests

-Fixed ContextTests for spring-jms and further fixes spring-session-mongodb

* BAEL-9496 Fix failing context tests

-Fixed context tests from spring-rest-angular project
This commit is contained in:
Dhawal Kapil
2019-09-25 18:55:50 +05:30
committed by Josh Cummings
parent 6f9c339986
commit af75e04e50
25 changed files with 77 additions and 101 deletions

View File

@@ -40,6 +40,12 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@@ -7,7 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringSessionMongoDBApplication.class)
@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SpringContextIntegrationTest {
@Test

View File

@@ -7,8 +7,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringSessionMongoDBApplication.class)
public class SpringContextLiveTest {
@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SpringContextTest {
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {

View File

@@ -0,0 +1,2 @@
#To use a randomly allocated free port during tests to avoid port conflict across tests
spring.data.mongodb.port=0