JAVA-22250 | bumping karate to a new version compatible with jdk 17 (#14230)

* JAVA-22250 | bumping karate to a new version compatible with jdk 17

* JAVA-22180 | removed unused lib and added correct scope.
This commit is contained in:
Gaetano Piazzolla 2023-06-18 11:23:46 +02:00 committed by GitHub
parent 191245c2da
commit d4c6226aa5
3 changed files with 20 additions and 32 deletions

View File

@ -26,23 +26,6 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- http client -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<!-- marshalling -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@ -66,6 +49,7 @@
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
@ -73,11 +57,6 @@
<version>${jbehave.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit4</artifactId>
@ -94,6 +73,18 @@
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<!-- https://github.com/karatelabs/karate#folder-structure -->
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -145,9 +136,7 @@
<rest-assured.version>2.9.0</rest-assured.version>
<cucumber.version>6.8.0</cucumber.version>
<wiremock.version>2.21.0</wiremock.version>
<karate.version>0.6.1</karate.version>
<httpcore.version>4.4.5</httpcore.version>
<httpclient.version>4.5.2</httpclient.version>
<karate.version>1.3.1</karate.version>
<jbehave.version>4.1</jbehave.version>
</properties>

View File

@ -2,17 +2,16 @@ package com.baeldung.rest.karate;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import cucumber.api.CucumberOptions;
import com.intuit.karate.junit4.Karate;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
//We need to upgrade to latest version of Karate for JDK17 --- JAVA-22250
//@RunWith(Karate.class)
@CucumberOptions(features = "classpath:karate")
@RunWith(Karate.class)
public class KarateIntegrationTest {
private static final int PORT_NUMBER = 8097;
@ -20,7 +19,7 @@ public class KarateIntegrationTest {
private static final WireMockServer wireMockServer = new WireMockServer(WireMockConfiguration.options().port(PORT_NUMBER));
@BeforeClass
public static void setUp() throws Exception {
public static void setUp() {
wireMockServer.start();
configureFor("localhost", PORT_NUMBER);
@ -30,7 +29,7 @@ public class KarateIntegrationTest {
.withHeader("Content-Type", "application/json")
.withBody("{ \"id\": \"1234\", name: \"John Smith\" }")));
stubFor(post(urlEqualTo("/user/create"))
.withHeader("content-type", equalTo("application/json"))
.withHeader("content-type", equalTo("application/json; charset=UTF-8"))
.withRequestBody(containing("id"))
.willReturn(aResponse()
.withStatus(200)
@ -40,7 +39,7 @@ public class KarateIntegrationTest {
}
@AfterClass
public static void tearDown() throws Exception {
public static void tearDown() {
wireMockServer.stop();
}