TestExecutor Gradle IntelliJ


(Ian Pea) #1

Dear Gentlemen.

We have a problem with gradle(also 3.5), which does not exist in IntelliJ.

It is a jUnit-test, which tests REST-interface of a port, ( reachable as Camel REST-service(route)).

The jUnit-tests works fine, when fired from within IntelliJ.

But when fired from gradle, “gradle test “ it cannot reach the TCP-IP Ports.

I should add, the PORT, is made available by a SpringBoot process. Which needs to be
started before the jUnit-test kicks in, this done with annotation @SpringBootTest

The test look as here below, Any idea welcome.

Kind regards

Ian Pea.

// @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = IdServiceApplication.class) // SpringBoot application
public class RestTest {

public void searchInternalMaskTest() throws Exception {

String mask =
        producerTemplate.requestBodyAndHeaders(

              “http://localhost:9097/idservice/id/87654321/category/Current_Account/mask”, null,    
             headers, String.class);
assertNotNull(mask);
assertTrue(mask.contains("00000001"));

}