test (JAVA SPRING RESTCLIENT) Add echo tests for the Spring 6 RestClient (#19145)

* test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api multipart form single file test

* feat (JAVA SPRING RESTCLIENT) 18522: Add RestClient to README

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo all of Pet test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body free form object response string test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body pet test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body pet response string test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body string enum test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo body tag response test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo form tests

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo header test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo path test

* test (JAVA SPRING RESTCLIENT) 18522: Add RestClient echo query tests

* feat (JAVA SPRING RESTCLIENT) 18522: Regenerasted API Clients for RestClient with fixed import indentation
This commit is contained in:
Nicklas Wiegandt 2024-07-17 06:19:31 +02:00 committed by GitHub
parent 0177ceda56
commit 3dc3ee08bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 511 additions and 300 deletions

View File

@ -84,13 +84,13 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification) (both 2.0 and 3.0 are supported). Currently, the following languages/frameworks are supported:
| | Languages/Frameworks |
| -------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 18.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
| | Languages/Frameworks |
| -------------------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, Spring 6 RestClient, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 18.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
## Table of contents
@ -998,6 +998,7 @@ Here is a list of template creators:
* Java (okhttp-gson): @xhh
* Java (RestTemplate): @nbruno
* Java (Spring 5 WebClient): @daonomic
* Java (Spring 6 RestClient): @nicklas2751
* Java (RESTEasy): @gayathrigs
* Java (Vertx): @lopesmcc
* Java (Google APIs Client Library): @charlescapps

View File

@ -12,8 +12,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
{{#withXml}}
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
{{/withXml}}

View File

@ -10,8 +10,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

View File

@ -15,17 +15,22 @@ package org.openapitools.client.api;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.openapitools.client.ApiClient;
import org.openapitools.client.GifHttpMessageConverter;
import org.openapitools.client.OctetStreamHttpMessageConverter;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.Pet.StatusEnum;
import org.openapitools.client.model.StringEnumRef;
import org.openapitools.client.model.Tag;
@ -117,11 +122,18 @@ public class BodyApiTest {
* <p>Test single binary in multipart mime
*/
@Test
public void testBodyMultipartFormdataSingleBinaryTest() {
File myFile = null;
String response = api.testBodyMultipartFormdataSingleBinary(myFile);
public void testBodyMultipartFormdataSingleBinaryTest() throws IOException {
// given
var testFile = Files.createTempFile("test", ".txt");
String testFileContent = "Lorem ipsum dolor sit amet";
Files.writeString(testFile, testFileContent);
// TODO: test validations
// when
String response = api.testBodyMultipartFormdataSingleBinary(testFile.toFile());
// then
assertThat(response, containsString("Content-Type: multipart/form-data"));
assertThat(response, containsString(testFileContent));
}
/**
@ -131,10 +143,26 @@ public class BodyApiTest {
*/
@Test
public void testEchoBodyAllOfPetTest() {
Pet pet = null;
// given
// The content length must be set to disable the Transfer-Encoding: chunked which would lead to
// unparsable response because the echo server is replying them as body.
api.getApiClient().addDefaultHeader("Content-Length", "192");
Pet pet =
new Pet()
.id(42L)
.name("Corgi")
.category(new Category().id(1L).name("Dogs"))
.status(StatusEnum.SOLD)
.addPhotoUrlsItem(
"https://cdn.pixabay.com/photo/2021/10/13/09/01/corgi-6705821_1280.jpg")
.addTagsItem(new Tag().id(1L).name("cute"));
// when
Pet response = api.testEchoBodyAllOfPet(pet);
// TODO: test validations
// then
assertThat(response, is(pet));
}
/**
@ -144,10 +172,22 @@ public class BodyApiTest {
*/
@Test
public void testEchoBodyFreeFormObjectResponseStringTest() {
Object body = null;
String response = api.testEchoBodyFreeFormObjectResponseString(body);
// given
// The content length must be set to disable the Transfer-Encoding: chunked which would lead to
// unparsable response because the echo server is replying them as body.
api.getApiClient().addDefaultHeader("Content-Length", "51");
// TODO: test validations
Object mapAsObject =
new HashMap<>(
Map.of(
"firstKey", "firstValue",
"secondKey", "secondValue"));
// when
String response = api.testEchoBodyFreeFormObjectResponseString(mapAsObject);
// then
assertThat(response, is("{\"firstKey\":\"firstValue\",\"secondKey\":\"secondValue\"}"));
}
/**
@ -157,10 +197,26 @@ public class BodyApiTest {
*/
@Test
public void testEchoBodyPetTest() {
Pet pet = null;
// given
// The content length must be set to disable the Transfer-Encoding: chunked which would lead to
// unparsable response because the echo server is replying them as body.
api.getApiClient().addDefaultHeader("Content-Length", "192");
Pet pet =
new Pet()
.id(42L)
.name("Corgi")
.category(new Category().id(1L).name("Dogs"))
.status(StatusEnum.SOLD)
.addPhotoUrlsItem(
"https://cdn.pixabay.com/photo/2021/10/13/09/01/corgi-6705821_1280.jpg")
.addTagsItem(new Tag().id(1L).name("cute"));
// when
Pet response = api.testEchoBodyPet(pet);
// TODO: test validations
// then
assertThat(response, is(pet));
}
/**
@ -170,10 +226,29 @@ public class BodyApiTest {
*/
@Test
public void testEchoBodyPetResponseStringTest() {
Pet pet = null;
// given
// The content length must be set to disable the Transfer-Encoding: chunked which would lead to
// unparsable response because the echo server is replying them as body.
api.getApiClient().addDefaultHeader("Content-Length", "192");
Pet pet =
new Pet()
.id(42L)
.name("Corgi")
.category(new Category().id(1L).name("Dogs"))
.status(StatusEnum.SOLD)
.addPhotoUrlsItem(
"https://cdn.pixabay.com/photo/2021/10/13/09/01/corgi-6705821_1280.jpg")
.addTagsItem(new Tag().id(1L).name("cute"));
// when
String response = api.testEchoBodyPetResponseString(pet);
// TODO: test validations
// then
assertThat(
response,
is(
"{\"id\":42,\"name\":\"Corgi\",\"category\":{\"id\":1,\"name\":\"Dogs\"},\"photoUrls\":[\"https://cdn.pixabay.com/photo/2021/10/13/09/01/corgi-6705821_1280.jpg\"],\"tags\":[{\"id\":1,\"name\":\"cute\"}],\"status\":\"sold\"}"));
}
/**
@ -183,10 +258,14 @@ public class BodyApiTest {
*/
@Test
public void testEchoBodyStringEnumTest() {
String body = null;
// given
String body = "\"failure\"";
// when
StringEnumRef response = api.testEchoBodyStringEnum(body);
// TODO: test validations
// then
assertThat(response, is(StringEnumRef.FAILURE));
}
/**
@ -196,9 +275,13 @@ public class BodyApiTest {
*/
@Test
public void testEchoBodyTagResponseStringTest() {
// given
Tag tag = null;
// when
String response = api.testEchoBodyTagResponseString(tag);
// TODO: test validations
// then
assertThat(response, nullValue());
}
}

View File

@ -10,72 +10,154 @@
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.model.TestFormObjectMultipartRequestMarker;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import org.junit.Ignore;
import org.openapitools.client.model.TestFormObjectMultipartRequestMarker;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* API tests for FormApi
*/
@Ignore
/** API tests for FormApi */
public class FormApiTest {
private final FormApi api = new FormApi();
private final FormApi api = new FormApi();
/**
* Test form parameter(s)
*
* Test form parameter(s)
*/
@Test
public void testFormIntegerBooleanStringTest() {
Integer integerForm = null;
Boolean booleanForm = null;
String stringForm = null;
String response = api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm);
/**
* Test form parameter(s)
*
* <p>Test form parameter(s)
*/
@Test
public void testFormIntegerBooleanStringTest() {
// Given
// The content length must be set to disable the Transfer-Encoding: chunked which would lead to
// unparsable response because the echo server is replying them as body.
api.getApiClient().addDefaultHeader("Content-Length", "53");
// TODO: test validations
}
/**
* Test form parameter(s) for multipart schema
*
* Test form parameter(s) for multipart schema
*/
@Test
public void testFormObjectMultipartTest() {
TestFormObjectMultipartRequestMarker marker = null;
String response = api.testFormObjectMultipart(marker);
Integer integerForm = 42;
Boolean booleanForm = true;
String stringForm = "Test123";
// TODO: test validations
}
/**
* Test form parameter(s) for oneOf schema
*
* Test form parameter(s) for oneOf schema
*/
@Test
public void testFormOneofTest() {
String form1 = null;
Integer form2 = null;
String form3 = null;
Boolean form4 = null;
Long id = null;
String name = null;
String response = api.testFormOneof(form1, form2, form3, form4, id, name);
// When
String response = api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm);
// TODO: test validations
}
}
// Then
assertThat(response, containsString("integer_form=42&boolean_form=true&string_form=Test123"));
}
/**
* Test form parameter(s) for multipart schema
*
* <p>Test form parameter(s) for multipart schema
*/
@Test
public void testFormObjectMultipartTest() {
// Given
TestFormObjectMultipartRequestMarker marker =
new TestFormObjectMultipartRequestMarker().name("Test Marker");
// When
String response = api.testFormObjectMultipart(marker);
// Then
assertThat(response, containsString("{\"name\":\"Test Marker\"}"));
}
/**
* Test form parameter(s) for oneOf schema with only the first parameters filled
*
* <p>Test form parameter(s) for oneOf schema
*/
@Test
public void testFormOneofTest_first() {
// Given
String form1 = "test12";
Integer form2 = 12;
String form3 = null;
Boolean form4 = null;
Long id = null;
String name = null;
// When
String response = api.testFormOneof(form1, form2, form3, form4, id, name);
// Then
assertThat(response, containsString("form1=test12&form2=12"));
}
/**
* Test form parameter(s) for oneOf schema with only the second parameters filled
*
* <p>Test form parameter(s) for oneOf schema
*/
@Test
public void testFormOneofTest_second() {
// Given
String form1 = null;
Integer form2 = null;
String form3 = "34test";
Boolean form4 = false;
Long id = null;
String name = null;
// When
String response = api.testFormOneof(form1, form2, form3, form4, id, name);
// Then
assertThat(response, containsString("form3=34test&form4=false"));
}
/**
* Test form parameter(s) for oneOf schema with only the third parameters filled
*
* <p>Test form parameter(s) for oneOf schema
*/
@Test
public void testFormOneofTest_third() {
// Given
String form1 = null;
Integer form2 = null;
String form3 = null;
Boolean form4 = null;
Long id = 21L;
String name = "Hans";
// When
String response = api.testFormOneof(form1, form2, form3, form4, id, name);
// Then
assertThat(response, containsString("id=21&name=Hans"));
}
/**
* Test form parameter(s) for oneOf schema with all parameters filled
*
* <p>Test form parameter(s) for oneOf schema
*/
@Test
public void testFormOneofTest_all() {
// Given
String form1 = "test12";
Integer form2 = 12;
String form3 = "34test";
Boolean form4 = false;
Long id = 21L;
String name = "Hans";
// When
String response = api.testFormOneof(form1, form2, form3, form4, id, name);
// Then
assertThat(
response, containsString("form1=test12&form2=12&form3=34test&form4=false&id=21&name=Hans"));
}
}

View File

@ -10,43 +10,51 @@
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.model.StringEnumRef;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import org.junit.Ignore;
import org.openapitools.client.model.StringEnumRef;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* API tests for HeaderApi
*/
@Ignore
/** API tests for HeaderApi */
public class HeaderApiTest {
private final HeaderApi api = new HeaderApi();
private final HeaderApi api = new HeaderApi();
/**
* Test header parameter(s)
*
* Test header parameter(s)
*/
@Test
public void testHeaderIntegerBooleanStringEnumsTest() {
Integer integerHeader = null;
Boolean booleanHeader = null;
String stringHeader = null;
String enumNonrefStringHeader = null;
StringEnumRef enumRefStringHeader = null;
String response = api.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader);
/**
* Test header parameter(s)
*
* <p>Test header parameter(s)
*/
@Test
public void testHeaderIntegerBooleanStringEnumsTest() {
// Given
Integer integerHeader = 11;
Boolean booleanHeader = true;
String stringHeader = "simple String Header";
String enumNonrefStringHeader = "false";
StringEnumRef enumRefStringHeader = StringEnumRef.UNCLASSIFIED;
// TODO: test validations
}
}
// When
String response =
api.testHeaderIntegerBooleanStringEnums(
integerHeader,
booleanHeader,
stringHeader,
enumNonrefStringHeader,
enumRefStringHeader);
// Then
assertThat(
response,
allOf(
containsString("integer_header: 11"),
containsString("boolean_header: true"),
containsString("string_header: simple String Header"),
containsString("enum_nonref_string_header: false"),
containsString("enum_ref_string_header: unclassified")));
}
}

View File

@ -10,42 +10,40 @@
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.model.StringEnumRef;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import org.junit.Ignore;
import org.openapitools.client.model.StringEnumRef;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* API tests for PathApi
*/
@Ignore
/** API tests for PathApi */
public class PathApiTest {
private final PathApi api = new PathApi();
private final PathApi api = new PathApi();
/**
* Test path parameter(s)
*
* Test path parameter(s)
*/
@Test
public void testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathTest() {
String pathString = null;
Integer pathInteger = null;
String enumNonrefStringPath = null;
StringEnumRef enumRefStringPath = null;
String response = api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
/**
* Test path parameter(s)
*
* <p>Test path parameter(s)
*/
@Test
public void
testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathTest() {
// Given
String pathString = "simple String Path";
Integer pathInteger = 50;
String enumNonrefStringPath = "true";
StringEnumRef enumRefStringPath = StringEnumRef.SUCCESS;
// TODO: test validations
}
}
// When
String response =
api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(
pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
// Then
assertThat(
response, containsString("/path/string/simple%20String%20Path/integer/50/true/success"));
}
}

View File

@ -10,167 +10,206 @@
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.model.DataQuery;
import java.time.LocalDate;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import java.time.Instant;
import java.time.LocalDate;
import java.util.List;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openapitools.client.model.DataQuery;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.StringEnumRef;
import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter;
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
import org.junit.Test;
import org.junit.Ignore;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* API tests for QueryApi
*/
@Ignore
/** API tests for QueryApi */
public class QueryApiTest {
private final QueryApi api = new QueryApi();
private final QueryApi api = new QueryApi();
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testEnumRefStringTest() {
String enumNonrefStringQuery = null;
StringEnumRef enumRefStringQuery = null;
String response = api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
public void testEnumRefStringTest() {
// Given
String enumNonrefStringQuery = "false";
StringEnumRef enumRefStringQuery = StringEnumRef.SUCCESS;
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryDatetimeDateStringTest() {
Instant datetimeQuery = null;
LocalDate dateQuery = null;
String stringQuery = null;
String response = api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery);
// When
String response = api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryIntegerBooleanStringTest() {
Integer integerQuery = null;
Boolean booleanQuery = null;
String stringQuery = null;
String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
// Then
assertThat(
response, containsString("?enum_nonref_string_query=false&enum_ref_string_query=success"));
}
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleDeepObjectExplodeTrueObjectTest() {
Pet queryObject = null;
String response = api.testQueryStyleDeepObjectExplodeTrueObject(queryObject);
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
public void testQueryDatetimeDateStringTest() {
// Given
Instant datetimeQuery = Instant.ofEpochMilli(1720361075);
LocalDate dateQuery = LocalDate.of(2024, 7, 7);
String stringQuery = "2024-07-07T16:05:59Z";
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleDeepObjectExplodeTrueObjectAllOfTest() {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = null;
String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject);
// When
String response = api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery);
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeFalseArrayIntegerTest() {
List<Integer> queryObject = null;
String response = api.testQueryStyleFormExplodeFalseArrayInteger(queryObject);
// Then
assertThat(
response,
containsString(
"?datetime_query=1970-01-20T21%3A52%3A41.075Z&date_query=2024-07-07&string_query=2024-07-07T16%3A05%3A59Z"));
}
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeFalseArrayStringTest() {
List<String> queryObject = null;
String response = api.testQueryStyleFormExplodeFalseArrayString(queryObject);
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
public void testQueryIntegerBooleanStringTest() {
// Given
Integer integerQuery = 42;
Boolean booleanQuery = false;
String stringQuery = "Hello World!";
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeTrueArrayStringTest() {
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = null;
String response = api.testQueryStyleFormExplodeTrueArrayString(queryObject);
// When
String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeTrueObjectTest() {
Pet queryObject = null;
String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
// Then
assertThat(
response,
containsString("?integer_query=42&boolean_query=false&string_query=Hello%20World%21"));
}
// TODO: test validations
}
/**
* Test query parameter(s)
*
* Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeTrueObjectAllOfTest() {
DataQuery queryObject = null;
String response = api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject);
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
@Disabled("The deep object style and the whole dynamic operations are currently not supported")
public void testQueryStyleDeepObjectExplodeTrueObjectTest() {
Pet queryObject = null;
String response = api.testQueryStyleDeepObjectExplodeTrueObject(queryObject);
// TODO: test validations
}
}
// Like Spring WebClient and RestTemplate, the deep object style is currently not
}
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
@Disabled("The deep object style and the whole dynamic operations are currently not supported")
public void testQueryStyleDeepObjectExplodeTrueObjectAllOfTest() {
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = null;
String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject);
// Like Spring WebClient and RestTemplate, the deep object style and the whole dynamic
// operations are currently not supported
}
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeFalseArrayIntegerTest() {
// Given
List<Integer> queryObject = List.of(1, 6, 2, 5, 3, 4);
// When
String response = api.testQueryStyleFormExplodeFalseArrayInteger(queryObject);
// Then
assertThat(response, containsString("?query_object=1%2C6%2C2%2C5%2C3%2C4"));
}
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
public void testQueryStyleFormExplodeFalseArrayStringTest() {
// Given
List<String> queryObject = List.of("Hello", "World");
// When
String response = api.testQueryStyleFormExplodeFalseArrayString(queryObject);
// Then
assertThat(response, containsString("?query_object=Hello%2CWorld"));
}
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
@Disabled("The deep object style and the whole dynamic operations are currently not supported")
public void testQueryStyleFormExplodeTrueArrayStringTest() {
// Given
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject =
new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter()
.addValuesItem("Hello")
.addValuesItem("Hallo")
.addValuesItem("Bonjour");
// When
String response = api.testQueryStyleFormExplodeTrueArrayString(queryObject);
// Then
// Like Spring WebClient and RestTemplate, the deep object style and the whole dynamic
// operations are currently not supported
assertThat(
response, containsString("?query_object=Hello&query_object=Hallo&query_object=Bonjour"));
}
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
@Disabled("The deep object style and the whole dynamic operations are currently not supported")
public void testQueryStyleFormExplodeTrueObjectTest() {
Pet queryObject = null;
String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
// TODO: test validations
// Like Spring WebClient and RestTemplate, the deep object style and the whole dynamic
// operations are currently not supported
}
/**
* Test query parameter(s)
*
* <p>Test query parameter(s)
*/
@Test
@Disabled("The deep object style and the whole dynamic operations are currently not supported")
public void testQueryStyleFormExplodeTrueObjectAllOfTest() {
DataQuery queryObject = null;
String response = api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject);
// TODO: test validations
// Like Spring WebClient and RestTemplate, the deep object style and the whole dynamic
// operations are currently not supported
}
}

View File

@ -10,8 +10,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

View File

@ -10,8 +10,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

View File

@ -10,8 +10,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

View File

@ -10,8 +10,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;