Skip to content

Commit

Permalink
[java][jersey2] update junit from 4.x to 5.x (major upgrade) (#11898)
Browse files Browse the repository at this point in the history
* update java jersey2 junit to 5.x

* update jersey2-java8-special-characters

* update jersey2-java8-localdatetime

* update samples/openapi3/client/petstore/java/jersey2-java8

* better code format
  • Loading branch information
wing328 committed Mar 18, 2022
1 parent a4d3204 commit 7cbdf4c
Show file tree
Hide file tree
Showing 222 changed files with 1,047 additions and 1,417 deletions.
Expand Up @@ -6,18 +6,18 @@ import {{invokerPackage}}.*;
import {{invokerPackage}}.auth.*;
{{#imports}}import {{import}};
{{/imports}}
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

{{^fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{/fullJavaUtil}}

{{/fullJavaUtil}}
/**
* API tests for {{classname}}
*/
Expand All @@ -28,12 +28,15 @@ public class {{classname}}Test {
{{#operations}}
{{#operation}}
/**
{{#summary}}
* {{summary}}
*
{{/summary}}
{{#notes}}
* {{notes}}
*
* @throws ApiException
* if the Api call fails
{{/notes}}
* @throws ApiException if the Api call fails
*/
@Test
public void {{operationId}}Test() throws ApiException {
Expand Down
@@ -0,0 +1,51 @@
{{>licenseInfo}}

package {{package}};

{{#imports}}import {{import}};
{{/imports}}

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

{{#fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

{{/fullJavaUtil}}
/**
* Model tests for {{classname}}
*/
public class {{classname}}Test {
{{#models}}
{{#model}}
{{^vendorExtensions.x-is-one-of-interface}}
{{^isEnum}}
private final {{classname}} model = new {{classname}}();

{{/isEnum}}
/**
* Model tests for {{classname}}
*/
@Test
public void test{{classname}}() {
// TODO: test {{classname}}
}

{{#allVars}}
/**
* Test the property '{{name}}'
*/
@Test
public void {{name}}Test() {
// TODO: test {{name}}
}

{{/allVars}}
{{/vendorExtensions.x-is-one-of-interface}}
{{/model}}
{{/models}}
}
Expand Up @@ -372,8 +372,8 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -389,7 +389,7 @@
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>
{{/useBeanValidation}}
<junit-version>4.13.2</junit-version>
<junit-version>5.8.2</junit-version>
{{#hasHttpSignatureMethods}}
<http-signature-version>1.7</http-signature-version>
{{/hasHttpSignatureMethods}}
Expand Down
Expand Up @@ -330,8 +330,8 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -344,7 +344,7 @@
<jackson-databind-version>2.13.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.2</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.2</junit-version>
<junit-version>5.8.2</junit-version>
<scribejava-apis-version>8.3.1</scribejava-apis-version>
<spotless.version>2.21.0</spotless.version>
</properties>
Expand Down
Expand Up @@ -16,10 +16,10 @@
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.Client;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -38,8 +38,7 @@ public class AnotherFakeApiTest {
*
* To test special tags and operation ID starting with number
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void call123testSpecialTagsTest() throws ApiException {
Expand Down
Expand Up @@ -24,10 +24,10 @@
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -46,8 +46,7 @@ public class FakeApiTest {
*
* this route creates an XmlItem
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void createXmlItemTest() throws ApiException {
Expand All @@ -57,12 +56,9 @@ public void createXmlItemTest() throws ApiException {
}

/**
*
*
* Test serialization of outer boolean types
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void fakeOuterBooleanSerializeTest() throws ApiException {
Expand All @@ -72,12 +68,9 @@ public void fakeOuterBooleanSerializeTest() throws ApiException {
}

/**
*
*
* Test serialization of object with outer number type
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void fakeOuterCompositeSerializeTest() throws ApiException {
Expand All @@ -87,12 +80,9 @@ public void fakeOuterCompositeSerializeTest() throws ApiException {
}

/**
*
*
* Test serialization of outer number types
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void fakeOuterNumberSerializeTest() throws ApiException {
Expand All @@ -102,12 +92,9 @@ public void fakeOuterNumberSerializeTest() throws ApiException {
}

/**
*
*
* Test serialization of outer string types
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void fakeOuterStringSerializeTest() throws ApiException {
Expand All @@ -117,12 +104,9 @@ public void fakeOuterStringSerializeTest() throws ApiException {
}

/**
*
*
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testBodyWithFileSchemaTest() throws ApiException {
Expand All @@ -132,12 +116,7 @@ public void testBodyWithFileSchemaTest() throws ApiException {
}

/**
*
*
*
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testBodyWithQueryParamsTest() throws ApiException {
Expand All @@ -152,8 +131,7 @@ public void testBodyWithQueryParamsTest() throws ApiException {
*
* To test \&quot;client\&quot; model
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testClientModelTest() throws ApiException {
Expand All @@ -167,8 +145,7 @@ public void testClientModelTest() throws ApiException {
*
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testEndpointParametersTest() throws ApiException {
Expand All @@ -195,8 +172,7 @@ public void testEndpointParametersTest() throws ApiException {
*
* To test enum parameters
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testEnumParametersTest() throws ApiException {
Expand All @@ -217,8 +193,7 @@ public void testEnumParametersTest() throws ApiException {
*
* Fake endpoint to test group parameters (optional)
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testGroupParametersTest() throws ApiException {
Expand All @@ -242,10 +217,7 @@ public void testGroupParametersTest() throws ApiException {
/**
* test inline additionalProperties
*
*
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testInlineAdditionalPropertiesTest() throws ApiException {
Expand All @@ -257,10 +229,7 @@ public void testInlineAdditionalPropertiesTest() throws ApiException {
/**
* test json serialization of form data
*
*
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testJsonFormDataTest() throws ApiException {
Expand All @@ -271,12 +240,9 @@ public void testJsonFormDataTest() throws ApiException {
}

/**
*
*
* To test the collection format in query parameters
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testQueryParameterCollectionFormatTest() throws ApiException {
Expand Down
Expand Up @@ -16,10 +16,10 @@
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.Client;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -38,8 +38,7 @@ public class FakeClassnameTags123ApiTest {
*
* To test class name in snake case
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void testClassnameTest() throws ApiException {
Expand Down

0 comments on commit 7cbdf4c

Please sign in to comment.