Skip to content

Commit 3805cf3

Browse files
upgrade resteasy to junit5 (#18615)
* upgrade resteasy to junit5 * fix echo_api tests * updated gradle/sbt/pom and generated samples with bin/generate-samples.sh * fix xml syntax error * forgot to run generate-samples.sh
1 parent 854e521 commit 3805cf3

93 files changed

Lines changed: 331 additions & 324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ ext {
106106
jakarta_annotation_version = "1.3.5"
107107
threetenbp_version = "2.9.10"
108108
resteasy_version = "4.5.11.Final"
109-
junit_version = "4.13"
109+
assertj_version = "3.23.1"
110+
junit_version = "5.10.2"
110111
}
111112

112113
dependencies {
@@ -124,5 +125,6 @@ dependencies {
124125
{{/openApiNullable}}
125126
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
126127
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
127-
testImplementation "junit:junit:$junit_version"
128+
testImplementation "org.assertj:assertj-core:$assertj_version"
129+
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
128130
}

modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.sbt.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ lazy val root = (project in file(".")).
1919
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
2020
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile",
2121
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
22-
"junit" % "junit" % "4.13" % "test",
22+
"org.assertj" % "assertj-core" % "3.23.1" % "test",
23+
"junit" % "junit" % "5.10.2" % "test",
2324
"com.novocode" % "junit-interface" % "0.10" % "test"
2425
)
2526
)

modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<plugin>
6262
<groupId>org.apache.maven.plugins</groupId>
6363
<artifactId>maven-surefire-plugin</artifactId>
64-
<version>2.12</version>
64+
<version>2.22.2</version>
6565
<configuration>
6666
<systemPropertyVariables>
6767
<property>
@@ -71,7 +71,6 @@
7171
</systemPropertyVariables>
7272
<argLine>-Xms512m -Xmx1500m</argLine>
7373
<parallel>methods</parallel>
74-
<forkMode>pertest</forkMode>
7574
</configuration>
7675
</plugin>
7776
<plugin>
@@ -278,8 +277,14 @@
278277
</dependency>
279278
<!-- test dependencies -->
280279
<dependency>
281-
<groupId>junit</groupId>
282-
<artifactId>junit</artifactId>
280+
<groupId>org.assertj</groupId>
281+
<artifactId>assertj-core</artifactId>
282+
<version>${assertj-version}</version>
283+
<scope>test</scope>
284+
</dependency>
285+
<dependency>
286+
<groupId>org.junit.jupiter</groupId>
287+
<artifactId>junit-jupiter-api</artifactId>
283288
<version>${junit-version}</version>
284289
<scope>test</scope>
285290
</dependency>
@@ -306,6 +311,7 @@
306311
{{/useJakartaEe}}
307312
<threetenbp-version>2.9.10</threetenbp-version>
308313
<maven-plugin-version>1.0.0</maven-plugin-version>
309-
<junit-version>4.13</junit-version>
314+
<assertj-version>3.23.1</assertj-version>
315+
<junit-version>5.10.2</junit-version>
310316
</properties>
311317
</project>

modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ for this project used jakarta.validation-api -->
138138
</exclusions>
139139
</dependency>
140140
<dependency>
141-
<groupId>junit</groupId>
142-
<artifactId>junit</artifactId>
141+
<groupId>org.junit.jupiter</groupId>
142+
<artifactId>junit-jupiter-api</artifactId>
143143
<version>${junit-version}</version>
144144
<scope>test</scope>
145145
</dependency>
@@ -150,8 +150,8 @@ for this project used jakarta.validation-api -->
150150
<scope>test</scope>
151151
<exclusions>
152152
<exclusion>
153-
<artifactId>junit</artifactId>
154-
<groupId>junit</groupId>
153+
<artifactId>junit-jupiter-api</artifactId>
154+
<groupId>org.junit.jupiter</groupId>
155155
</exclusion>
156156
<exclusion>
157157
<artifactId>snakeyaml</artifactId>
@@ -198,7 +198,7 @@ for this project used jakarta.validation-api -->
198198
<jetty-version>9.2.9.v20150224</jetty-version>
199199
<resteasy-version>3.0.11.Final</resteasy-version>
200200
<slf4j-version>1.6.3</slf4j-version>
201-
<junit-version>4.13.2</junit-version>
201+
<junit-version>5.10.2</junit-version>
202202
<servlet-api-version>4.0.4</servlet-api-version>
203203
{{#useBeanValidation}}
204204
<beanvalidation-version>2.0.2</beanvalidation-version>

modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pom.mustache

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ for this project used jakarta.validation-api -->
160160
</exclusions>
161161
</dependency>
162162
<dependency>
163-
<groupId>junit</groupId>
164-
<artifactId>junit</artifactId>
163+
<groupId>org.junit.jupiter</groupId>
164+
<artifactId>junit-jupiter-api</artifactId>
165165
<version>${junit-version}</version>
166166
<scope>test</scope>
167167
</dependency>
@@ -172,8 +172,8 @@ for this project used jakarta.validation-api -->
172172
<scope>test</scope>
173173
<exclusions>
174174
<exclusion>
175-
<artifactId>junit</artifactId>
176-
<groupId>junit</groupId>
175+
<artifactId>junit-jupiter-api</artifactId>
176+
<groupId>org.junit.jupiter</groupId>
177177
</exclusion>
178178
<exclusion>
179179
<artifactId>snakeyaml</artifactId>
@@ -216,7 +216,7 @@ for this project used jakarta.validation-api -->
216216
<jetty-version>9.2.9.v20150224</jetty-version>
217217
<resteasy-version>3.13.0.Final</resteasy-version>
218218
<slf4j-version>1.6.3</slf4j-version>
219-
<junit-version>4.13.2</junit-version>
219+
<junit-version>5.10.2</junit-version>
220220
<servlet-api-version>4.0.4</servlet-api-version>
221221
{{#useJakartaEe}}
222222
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

samples/client/echo_api/java/resteasy/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ ext {
104104
jakarta_annotation_version = "1.3.5"
105105
threetenbp_version = "2.9.10"
106106
resteasy_version = "4.5.11.Final"
107-
junit_version = "4.13"
107+
assertj_version = "3.23.1"
108+
junit_version = "5.10.2"
108109
}
109110

110111
dependencies {
@@ -120,5 +121,6 @@ dependencies {
120121
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
121122
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
122123
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
123-
testImplementation "junit:junit:$junit_version"
124+
testImplementation "org.assertj:assertj-core:$assertj_version"
125+
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
124126
}

samples/client/echo_api/java/resteasy/build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ lazy val root = (project in file(".")).
1919
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
2020
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile",
2121
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
22-
"junit" % "junit" % "4.13" % "test",
22+
"org.assertj" % "assertj-core" % "3.23.1" % "test",
23+
"junit" % "junit" % "5.10.2" % "test",
2324
"com.novocode" % "junit-interface" % "0.10" % "test"
2425
)
2526
)

samples/client/echo_api/java/resteasy/pom.xml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<plugin>
5555
<groupId>org.apache.maven.plugins</groupId>
5656
<artifactId>maven-surefire-plugin</artifactId>
57-
<version>2.12</version>
57+
<version>2.22.2</version>
5858
<configuration>
5959
<systemPropertyVariables>
6060
<property>
@@ -64,7 +64,6 @@
6464
</systemPropertyVariables>
6565
<argLine>-Xms512m -Xmx1500m</argLine>
6666
<parallel>methods</parallel>
67-
<forkMode>pertest</forkMode>
6867
</configuration>
6968
</plugin>
7069
<plugin>
@@ -240,8 +239,14 @@
240239
</dependency>
241240
<!-- test dependencies -->
242241
<dependency>
243-
<groupId>junit</groupId>
244-
<artifactId>junit</artifactId>
242+
<groupId>org.assertj</groupId>
243+
<artifactId>assertj-core</artifactId>
244+
<version>${assertj-version}</version>
245+
<scope>test</scope>
246+
</dependency>
247+
<dependency>
248+
<groupId>org.junit.jupiter</groupId>
249+
<artifactId>junit-jupiter-api</artifactId>
245250
<version>${junit-version}</version>
246251
<scope>test</scope>
247252
</dependency>
@@ -255,6 +260,7 @@
255260
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
256261
<threetenbp-version>2.9.10</threetenbp-version>
257262
<maven-plugin-version>1.0.0</maven-plugin-version>
258-
<junit-version>4.13</junit-version>
263+
<assertj-version>3.23.1</assertj-version>
264+
<junit-version>5.10.2</junit-version>
259265
</properties>
260266
</project>

samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/CustomTest.java

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,18 @@
1111
*/
1212

1313

14-
package org.openapitools.client.api;
14+
package org.openapitools.client;
1515

16-
import org.openapitools.client.ApiException;
17-
import java.io.File;
18-
import org.openapitools.client.model.Pet;
19-
import org.openapitools.client.model.Tag;
20-
import org.junit.Test;
21-
import org.junit.Ignore;
22-
import org.junit.Assert;
16+
import org.junit.jupiter.api.Test;
17+
import org.openapitools.client.api.BodyApi;
18+
import org.openapitools.client.api.EchoServerResponseParser;
2319

20+
import java.io.File;
2421
import java.io.FileWriter;
2522
import java.io.IOException;
26-
import java.time.LocalDate;
27-
import java.time.OffsetDateTime;
28-
import java.util.ArrayList;
29-
import java.util.HashMap;
30-
import java.util.List;
31-
import java.util.Map;
3223

33-
import static org.hamcrest.CoreMatchers.containsString;
34-
import static org.hamcrest.MatcherAssert.assertThat;
35-
import static org.junit.Assert.assertTrue;
24+
import static org.assertj.core.api.Assertions.assertThat;
25+
import static org.junit.jupiter.api.Assertions.assertTrue;
3626

3727
/**
3828
* API tests
@@ -62,12 +52,12 @@ public void testBodyMultipartFormdataSingleBinaryTest() throws ApiException, IOE
6252
api.testBodyMultipartFormdataSingleBinary(myFile);
6353

6454
EchoServerResponseParser parser =
65-
new EchoServerResponseParser(response);
55+
new org.openapitools.client.api.EchoServerResponseParser(response);
6656

6757
String contentDisposition = parser.headers.get("Content-Disposition");
6858

69-
assertThat(contentDisposition, containsString(
59+
assertThat(contentDisposition).contains(
7060
"form-data; name=\"my-file\"; filename=\"test.txt\""
71-
));
61+
);
7262
}
7363
}

samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/api/AuthApiTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
package org.openapitools.client.api;
1515

1616
import org.openapitools.client.ApiException;
17-
import org.junit.Test;
18-
import org.junit.Ignore;
19-
import org.junit.Assert;
17+
import org.junit.jupiter.api.Test;
18+
import org.junit.jupiter.api.Disabled;
19+
import org.junit.jupiter.api.Assertions;
2020

2121
import java.time.LocalDate;
2222
import java.time.OffsetDateTime;

0 commit comments

Comments
 (0)