Skip to content

Commit d667f82

Browse files
author
Adam Karpowich
committed
fixed functional test base so app starts up properly
1 parent a9a54e9 commit d667f82

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
package org.template.functional;
22

3-
import org.template.Application;
43
import com.jayway.restassured.RestAssured;
54
import org.junit.Before;
65
import org.junit.runner.RunWith;
76
import org.springframework.boot.test.context.SpringBootTest;
8-
import org.springframework.test.context.ActiveProfiles;
7+
import org.springframework.boot.web.server.LocalServerPort;
98
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10-
import org.springframework.test.context.web.WebAppConfiguration;
9+
import org.template.Application;
1110

1211

13-
//TODO: fix this configuration so that application starts up correctly
14-
//Functional tests will currently run but you need to start the app separately
1512
@RunWith(SpringJUnit4ClassRunner.class)
16-
@SpringBootTest(classes = { Application.class })
17-
@ActiveProfiles("test")
18-
@WebAppConfiguration
13+
@SpringBootTest(classes = { Application.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
1914
public abstract class TemplateServiceFunctionalTestBase {
2015

16+
@LocalServerPort private Integer port;
17+
2118
@Before
2219
public void setUp() {
23-
RestAssured.port = 8080;
20+
RestAssured.port = port;
2421
}
2522
}

0 commit comments

Comments
 (0)