+
import com.jayway.restassured.RestAssured;
+import org.junit.Before;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest(classes = ContextPathTestingBaseClass.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+class ContextPathTestingBaseClass {
+
+ @LocalServerPort int port;
+
+ @Before
+ public void setup() {
+ RestAssured.baseURI = "http://localhost";
+ RestAssured.port = this.port;
+ }
+}
+