0

I am new to gradle.Working on a spring-boot application. For my tests I have created a mock service using wiremock and want to use that service for a particular endpoint. The original endpoint address is in the application.yml file and I have created test-application.yml file which has the address of the mock service. In gradle I have created the sourceSet and it works fine.

integrationTest {
    java {
        compileClasspath += main.output + test.output
        runtimeClasspath += main.output + test.output
        srcDir file('src/integrationTest/java')
    }
    resources.srcDir file('src/integrationTest/resources')
}

How can I embedde the mock service so that my tests hit the mock service and not the real service?

worrynerd
  • 705
  • 1
  • 12
  • 31
  • 1
    are we talking about spring ?? – Antoniossss Sep 27 '17 at 23:42
  • Yes . its a spring-boot application – worrynerd Sep 28 '17 at 16:43
  • Did you check Spring's documentation about testing?? It is clearly specified how to run integration testing and how to mock components. https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html. In your case, most probably using dedicated properties file or/and profile will do the trick. – Antoniossss Sep 29 '17 at 07:29

0 Answers0