forked from loafle/openapi-generator-original
[Java Libraries] Jakarta Validation API support useJakartaEe flag (#19469)
* Jakarta Validation API support useJakartaEe flag * Jakarta Validation API support useJakartaEe flag
This commit is contained in:
@@ -285,6 +285,7 @@
|
||||
<jackson-databind-version>2.17.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
<junit-version>5.10.2</junit-version>
|
||||
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
|
||||
</properties>
|
||||
|
||||
@@ -13,50 +13,46 @@
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API tests for AuthApi
|
||||
*/
|
||||
@Disabled
|
||||
public class AuthApiTest {
|
||||
|
||||
private final AuthApi api = new AuthApi();
|
||||
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
*
|
||||
* <p>To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
*/
|
||||
@Test
|
||||
public void testAuthHttpBasicTest() {
|
||||
// given
|
||||
api.getApiClient().setUsername("test_user");
|
||||
api.getApiClient().setPassword("test_password");
|
||||
|
||||
// when
|
||||
public void testAuthHttpBasicTest() {
|
||||
String response = api.testAuthHttpBasic();
|
||||
|
||||
assertThat(
|
||||
response,
|
||||
containsString("Authorization: Basic dGVzdF91c2VyOnRlc3RfcGFzc3dvcmQ="));
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
*
|
||||
* <p>To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
*/
|
||||
@Test
|
||||
public void testAuthHttpBearerTest() {
|
||||
// given
|
||||
api.getApiClient().setBearerToken("test_token");
|
||||
|
||||
// when
|
||||
public void testAuthHttpBearerTest() {
|
||||
String response = api.testAuthHttpBearer();
|
||||
|
||||
assertThat(response, containsString("Authorization: Bearer test_token"));
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,278 +10,158 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
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 org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.client.model.Tag;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/** API tests for BodyApi */
|
||||
/**
|
||||
* API tests for BodyApi
|
||||
*/
|
||||
@Disabled
|
||||
public class BodyApiTest {
|
||||
|
||||
private final BodyApi api = new BodyApi();
|
||||
private final BodyApi api = new BodyApi();
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
*
|
||||
* <p>Test binary (gif) response body
|
||||
*/
|
||||
@Test
|
||||
public void testBinaryGifTest() throws IOException {
|
||||
// given
|
||||
var restClient =
|
||||
ApiClient.buildRestClientBuilder()
|
||||
.messageConverters(converters -> converters.add(new GifHttpMessageConverter()))
|
||||
.build();
|
||||
api.setApiClient(new ApiClient(restClient));
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
*
|
||||
* Test binary (gif) response body
|
||||
*/
|
||||
@Test
|
||||
public void testBinaryGifTest() {
|
||||
File response = api.testBinaryGif();
|
||||
|
||||
// when
|
||||
File response = api.testBinaryGif();
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testBodyApplicationOctetstreamBinaryTest() {
|
||||
File body = null;
|
||||
String response = api.testBodyApplicationOctetstreamBinary(body);
|
||||
|
||||
// then
|
||||
assertThat(response, notNullValue());
|
||||
assertThat(response.exists(), is(true));
|
||||
assertThat(Files.probeContentType(response.toPath()), is("image/gif"));
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
*
|
||||
* Test array of binary in multipart mime
|
||||
*/
|
||||
@Test
|
||||
public void testBodyMultipartFormdataArrayOfBinaryTest() {
|
||||
List<File> files = null;
|
||||
String response = api.testBodyMultipartFormdataArrayOfBinary(files);
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* <p>Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testBodyApplicationOctetstreamBinaryTest() throws IOException {
|
||||
// given
|
||||
var restClient =
|
||||
ApiClient.buildRestClientBuilder()
|
||||
.messageConverters(converters -> converters.add(new OctetStreamHttpMessageConverter()))
|
||||
.build();
|
||||
api.setApiClient(new ApiClient(restClient));
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
*
|
||||
* Test single binary in multipart mime
|
||||
*/
|
||||
@Test
|
||||
public void testBodyMultipartFormdataSingleBinaryTest() {
|
||||
File myFile = null;
|
||||
String response = api.testBodyMultipartFormdataSingleBinary(myFile);
|
||||
|
||||
var tempFile = Files.createTempFile("test", ".txt");
|
||||
Files.writeString(tempFile, "test123");
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyAllOfPetTest() {
|
||||
Pet pet = null;
|
||||
Pet response = api.testEchoBodyAllOfPet(pet);
|
||||
|
||||
File body = tempFile.toFile();
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
*
|
||||
* Test free form object
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyFreeFormObjectResponseStringTest() {
|
||||
Object body = null;
|
||||
String response = api.testEchoBodyFreeFormObjectResponseString(body);
|
||||
|
||||
// when
|
||||
String response = api.testBodyApplicationOctetstreamBinary(body);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetTest() {
|
||||
Pet pet = null;
|
||||
Pet response = api.testEchoBodyPet(pet);
|
||||
|
||||
// then
|
||||
assertThat(response, containsString("Content-Type: application/octet-stream"));
|
||||
assertThat(response, containsString("test123"));
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
*
|
||||
* Test empty response body
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetResponseStringTest() {
|
||||
Pet pet = null;
|
||||
String response = api.testEchoBodyPetResponseString(pet);
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
*
|
||||
* <p>Test array of binary in multipart mime
|
||||
*/
|
||||
@Test
|
||||
public void testBodyMultipartFormdataArrayOfBinaryTest() throws IOException {
|
||||
// given
|
||||
var firstFile = Files.createTempFile("test", ".txt");
|
||||
String firstFileContent = "Thanks for using OpenAPI generator :)";
|
||||
Files.writeString(firstFile, firstFileContent);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
*
|
||||
* Test string enum response body
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyStringEnumTest() {
|
||||
String body = null;
|
||||
StringEnumRef response = api.testEchoBodyStringEnum(body);
|
||||
|
||||
var secondFile = Files.createTempFile("test2", ".txt");
|
||||
String secondFileContent = "Your ad could be here";
|
||||
Files.writeString(secondFile, secondFileContent);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
*
|
||||
* Test empty json (request body)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyTagResponseStringTest() {
|
||||
Tag tag = null;
|
||||
String response = api.testEchoBodyTagResponseString(tag);
|
||||
|
||||
List<File> files = List.of(firstFile.toFile(), secondFile.toFile());
|
||||
|
||||
// when
|
||||
String response = api.testBodyMultipartFormdataArrayOfBinary(files);
|
||||
|
||||
// then
|
||||
assertThat(response, containsString("Content-Type: multipart/form-data"));
|
||||
assertThat(response, containsString(firstFileContent));
|
||||
assertThat(response, containsString(secondFileContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
*
|
||||
* <p>Test single binary in multipart mime
|
||||
*/
|
||||
@Test
|
||||
public void testBodyMultipartFormdataSingleBinaryTest() throws IOException {
|
||||
// given
|
||||
var testFile = Files.createTempFile("test", ".txt");
|
||||
String testFileContent = "Lorem ipsum dolor sit amet";
|
||||
Files.writeString(testFile, testFileContent);
|
||||
|
||||
// when
|
||||
String response = api.testBodyMultipartFormdataSingleBinary(testFile.toFile());
|
||||
|
||||
// then
|
||||
assertThat(response, containsString("Content-Type: multipart/form-data"));
|
||||
assertThat(response, containsString(testFileContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* <p>Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyAllOfPetTest() {
|
||||
// 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);
|
||||
|
||||
// then
|
||||
assertThat(response, is(pet));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
*
|
||||
* <p>Test free form object
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyFreeFormObjectResponseStringTest() {
|
||||
// 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");
|
||||
|
||||
Object mapAsObject =
|
||||
new HashMap<>(
|
||||
Map.of(
|
||||
"firstKey", "firstValue",
|
||||
"secondKey", "secondValue"));
|
||||
|
||||
// when
|
||||
String response = api.testEchoBodyFreeFormObjectResponseString(mapAsObject);
|
||||
|
||||
// then
|
||||
assertThat(response, is("{\"firstKey\":\"firstValue\",\"secondKey\":\"secondValue\"}"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* <p>Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetTest() {
|
||||
// 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);
|
||||
|
||||
// then
|
||||
assertThat(response, is(pet));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
*
|
||||
* <p>Test empty response body
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetResponseStringTest() {
|
||||
// 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);
|
||||
|
||||
// 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\"}"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
*
|
||||
* <p>Test string enum response body
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyStringEnumTest() {
|
||||
// given
|
||||
String body = "\"failure\"";
|
||||
|
||||
// when
|
||||
StringEnumRef response = api.testEchoBodyStringEnum(body);
|
||||
|
||||
// then
|
||||
assertThat(response, is(StringEnumRef.FAILURE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
*
|
||||
* <p>Test empty json (request body)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyTagResponseStringTest() {
|
||||
// given
|
||||
Tag tag = null;
|
||||
|
||||
// when
|
||||
String response = api.testEchoBodyTagResponseString(tag);
|
||||
|
||||
// then
|
||||
assertThat(response, nullValue());
|
||||
}
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,154 +10,72 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.openapitools.client.model.TestFormObjectMultipartRequestMarker;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** API tests for FormApi */
|
||||
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
|
||||
*/
|
||||
@Disabled
|
||||
public class FormApiTest {
|
||||
|
||||
private final FormApi api = new FormApi();
|
||||
private final FormApi api = new FormApi();
|
||||
|
||||
/**
|
||||
* 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");
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
Integer integerForm = 42;
|
||||
Boolean booleanForm = true;
|
||||
String stringForm = "Test123";
|
||||
// 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);
|
||||
|
||||
// When
|
||||
String response = api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm);
|
||||
// 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);
|
||||
|
||||
// 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"));
|
||||
}
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,51 +10,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** API tests for HeaderApi */
|
||||
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
|
||||
*/
|
||||
@Disabled
|
||||
public class HeaderApiTest {
|
||||
|
||||
private final HeaderApi api = new HeaderApi();
|
||||
private final HeaderApi api = new HeaderApi();
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// 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")));
|
||||
}
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,40 +10,42 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** API tests for PathApi */
|
||||
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
|
||||
*/
|
||||
@Disabled
|
||||
public class PathApiTest {
|
||||
|
||||
private final PathApi api = new PathApi();
|
||||
private final PathApi api = new PathApi();
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// When
|
||||
String response =
|
||||
api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(
|
||||
pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
|
||||
|
||||
// Then
|
||||
assertThat(
|
||||
response, containsString("/path/string/simple%20String%20Path/integer/50/true/success"));
|
||||
}
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,206 +10,167 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
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 java.time.LocalDate;
|
||||
import java.time.Instant;
|
||||
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.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** API tests for QueryApi */
|
||||
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
|
||||
*/
|
||||
@Disabled
|
||||
public class QueryApiTest {
|
||||
|
||||
private final QueryApi api = new QueryApi();
|
||||
private final QueryApi api = new QueryApi();
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* <p>Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEnumRefStringTest() {
|
||||
// Given
|
||||
String enumNonrefStringQuery = "false";
|
||||
StringEnumRef enumRefStringQuery = StringEnumRef.SUCCESS;
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEnumRefStringTest() {
|
||||
String enumNonrefStringQuery = null;
|
||||
StringEnumRef enumRefStringQuery = null;
|
||||
String response = api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
|
||||
|
||||
// When
|
||||
String response = api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
|
||||
// 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);
|
||||
|
||||
// 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 testQueryIntegerBooleanStringTest() {
|
||||
Integer integerQuery = null;
|
||||
Boolean booleanQuery = null;
|
||||
String stringQuery = null;
|
||||
String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||
|
||||
/**
|
||||
* 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 testQueryStyleDeepObjectExplodeTrueObjectTest() {
|
||||
Pet queryObject = null;
|
||||
String response = api.testQueryStyleDeepObjectExplodeTrueObject(queryObject);
|
||||
|
||||
// When
|
||||
String response = api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleDeepObjectExplodeTrueObjectAllOfTest() {
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = null;
|
||||
String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(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 testQueryStyleFormExplodeFalseArrayIntegerTest() {
|
||||
List<Integer> queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeFalseArrayInteger(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 testQueryStyleFormExplodeFalseArrayStringTest() {
|
||||
List<String> queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeFalseArrayString(queryObject);
|
||||
|
||||
// When
|
||||
String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeTrueArrayStringTest() {
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeTrueArrayString(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 testQueryStyleFormExplodeTrueObjectTest() {
|
||||
Pet queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeTrueObject(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
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeTrueObjectAllOfTest() {
|
||||
DataQuery queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject);
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user