[java] improve petstore tests with openapi v3 spec (#16447)

* regenerate tests in jersey2-java8 client

* update samples

* fix java google api client tests

* update java resteasy to use v3 spec for tests

* update java vertx to test with v3 spec

* update java resttemplate to test with v3 spec

* add new files

* regenerate jersey1 tests
This commit is contained in:
William Cheng 2023-08-30 12:33:01 +08:00 committed by GitHub
parent 611a60411b
commit 8386a6eaaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
615 changed files with 22444 additions and 10026 deletions

View File

@ -1,6 +1,6 @@
generatorName: java
outputDir: samples/client/petstore/java/resteasy
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-resteasy

View File

@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/resttemplate-withXml
library: resttemplate
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
java8: true

View File

@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/resttemplate
library: resttemplate
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-resttemplate

View File

@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/vertx
library: vertx
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-vertx

View File

@ -0,0 +1,14 @@
# AllOfWithSingleRef
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**username** | **String** | | [optional] |
|**singleRefType** | **SingleRefType** | | [optional] |

View File

@ -0,0 +1,69 @@
# DefaultApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | |
## fooGet
> FooGetDefaultResponse fooGet()
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
DefaultApi apiInstance = new DefaultApi(defaultClient);
try {
FooGetDefaultResponse result = apiInstance.fooGet();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#fooGet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**FooGetDefaultResponse**](FooGetDefaultResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **0** | response | - |

View File

@ -0,0 +1,13 @@
# DeprecatedObject
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**name** | **String** | | [optional] |

View File

@ -0,0 +1,14 @@
# FakeBigDecimalMap200Response
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**someId** | **BigDecimal** | | [optional] |
|**someMap** | **Map<String, BigDecimal>** | | [optional] |

View File

@ -0,0 +1,13 @@
# Foo
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**bar** | **String** | | [optional] |

View File

@ -0,0 +1,13 @@
# FooGetDefaultResponse
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**string** | [**Foo**](Foo.md) | | [optional] |

View File

@ -0,0 +1,14 @@
# HealthCheckResult
Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**nullableMessage** | **String** | | [optional] |

View File

@ -0,0 +1,24 @@
# NullableClass
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**integerProp** | **Integer** | | [optional] |
|**numberProp** | **BigDecimal** | | [optional] |
|**booleanProp** | **Boolean** | | [optional] |
|**stringProp** | **String** | | [optional] |
|**dateProp** | **LocalDate** | | [optional] |
|**datetimeProp** | **OffsetDateTime** | | [optional] |
|**arrayNullableProp** | **List<Object>** | | [optional] |
|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] |
|**arrayItemsNullable** | **List<Object>** | | [optional] |
|**objectNullableProp** | **Map<String, Object>** | | [optional] |
|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] |
|**objectItemsNullable** | **Map<String, Object>** | | [optional] |

View File

@ -0,0 +1,16 @@
# ObjectWithDeprecatedFields
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**uuid** | **String** | | [optional] |
|**id** | **BigDecimal** | | [optional] |
|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] |
|**bars** | **List<String>** | | [optional] |

View File

@ -0,0 +1,15 @@
# OuterEnumDefaultValue
## Enum
* `PLACED` (value: `"placed"`)
* `APPROVED` (value: `"approved"`)
* `DELIVERED` (value: `"delivered"`)

View File

@ -0,0 +1,15 @@
# OuterEnumInteger
## Enum
* `NUMBER_0` (value: `0`)
* `NUMBER_1` (value: `1`)
* `NUMBER_2` (value: `2`)

View File

@ -0,0 +1,15 @@
# OuterEnumIntegerDefaultValue
## Enum
* `NUMBER_0` (value: `0`)
* `NUMBER_1` (value: `1`)
* `NUMBER_2` (value: `2`)

View File

@ -0,0 +1,13 @@
# OuterObjectWithEnumProperty
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**value** | **OuterEnumInteger** | | |

View File

@ -0,0 +1,13 @@
# SingleRefType
## Enum
* `ADMIN` (value: `"admin"`)
* `USER` (value: `"user"`)

View File

@ -0,0 +1,108 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.FooGetDefaultResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.api.client.http.EmptyContent;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpContent;
import com.google.api.client.http.InputStreamContent;
import com.google.api.client.http.HttpMethods;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.json.Json;
import javax.ws.rs.core.UriBuilder;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DefaultApi {
private ApiClient apiClient;
public DefaultApi() {
this(new ApiClient());
}
public DefaultApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* <p><b>0</b> - response
* @return FooGetDefaultResponse
* @throws IOException if an error occurs while attempting to invoke the API
**/
public FooGetDefaultResponse fooGet() throws IOException {
HttpResponse response = fooGetForHttpResponse();
TypeReference<FooGetDefaultResponse> typeRef = new TypeReference<FooGetDefaultResponse>() {};
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* <p><b>0</b> - response
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return FooGetDefaultResponse
* @throws IOException if an error occurs while attempting to invoke the API
**/
public FooGetDefaultResponse fooGet(Map<String, Object> params) throws IOException {
HttpResponse response = fooGetForHttpResponse(params);
TypeReference<FooGetDefaultResponse> typeRef = new TypeReference<FooGetDefaultResponse>() {};
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse fooGetForHttpResponse() throws IOException {
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/foo");
String localVarUrl = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(localVarUrl);
HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
}
public HttpResponse fooGetForHttpResponse(Map<String, Object> params) throws IOException {
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/foo");
// Copy the params argument if present, to allow passing in immutable maps
Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (key != null && value != null) {
if (value instanceof Collection) {
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
} else if (value instanceof Object[]) {
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
} else {
uriBuilder = uriBuilder.queryParam(key, value);
}
}
}
String localVarUrl = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(localVarUrl);
HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
}
}

View File

@ -0,0 +1,136 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.SingleRefType;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* AllOfWithSingleRef
*/
@JsonPropertyOrder({
AllOfWithSingleRef.JSON_PROPERTY_USERNAME,
AllOfWithSingleRef.JSON_PROPERTY_SINGLE_REF_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AllOfWithSingleRef {
public static final String JSON_PROPERTY_USERNAME = "username";
private String username;
public static final String JSON_PROPERTY_SINGLE_REF_TYPE = "SingleRefType";
private SingleRefType singleRefType;
public AllOfWithSingleRef() {
}
public AllOfWithSingleRef username(String username) {
this.username = username;
return this;
}
/**
* Get username
* @return username
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_USERNAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getUsername() {
return username;
}
@JsonProperty(JSON_PROPERTY_USERNAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUsername(String username) {
this.username = username;
}
public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) {
this.singleRefType = singleRefType;
return this;
}
/**
* Get singleRefType
* @return singleRefType
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public SingleRefType getSingleRefType() {
return singleRefType;
}
@JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSingleRefType(SingleRefType singleRefType) {
this.singleRefType = singleRefType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o;
return Objects.equals(this.username, allOfWithSingleRef.username) &&
Objects.equals(this.singleRefType, allOfWithSingleRef.singleRefType);
}
@Override
public int hashCode() {
return Objects.hash(username, singleRefType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AllOfWithSingleRef {\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,105 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* DeprecatedObject
* @deprecated
*/
@Deprecated
@JsonPropertyOrder({
DeprecatedObject.JSON_PROPERTY_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DeprecatedObject {
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public DeprecatedObject() {
}
public DeprecatedObject name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DeprecatedObject deprecatedObject = (DeprecatedObject) o;
return Objects.equals(this.name, deprecatedObject.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DeprecatedObject {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,147 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* FakeBigDecimalMap200Response
*/
@JsonPropertyOrder({
FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID,
FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP
})
@JsonTypeName("fakeBigDecimalMap_200_response")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class FakeBigDecimalMap200Response {
public static final String JSON_PROPERTY_SOME_ID = "someId";
private BigDecimal someId;
public static final String JSON_PROPERTY_SOME_MAP = "someMap";
private Map<String, BigDecimal> someMap = new HashMap<>();
public FakeBigDecimalMap200Response() {
}
public FakeBigDecimalMap200Response someId(BigDecimal someId) {
this.someId = someId;
return this;
}
/**
* Get someId
* @return someId
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SOME_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public BigDecimal getSomeId() {
return someId;
}
@JsonProperty(JSON_PROPERTY_SOME_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSomeId(BigDecimal someId) {
this.someId = someId;
}
public FakeBigDecimalMap200Response someMap(Map<String, BigDecimal> someMap) {
this.someMap = someMap;
return this;
}
public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) {
if (this.someMap == null) {
this.someMap = new HashMap<>();
}
this.someMap.put(key, someMapItem);
return this;
}
/**
* Get someMap
* @return someMap
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SOME_MAP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Map<String, BigDecimal> getSomeMap() {
return someMap;
}
@JsonProperty(JSON_PROPERTY_SOME_MAP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSomeMap(Map<String, BigDecimal> someMap) {
this.someMap = someMap;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o;
return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) &&
Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap);
}
@Override
public int hashCode() {
return Objects.hash(someId, someMap);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FakeBigDecimalMap200Response {\n");
sb.append(" someId: ").append(toIndentedString(someId)).append("\n");
sb.append(" someMap: ").append(toIndentedString(someMap)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,103 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* Foo
*/
@JsonPropertyOrder({
Foo.JSON_PROPERTY_BAR
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Foo {
public static final String JSON_PROPERTY_BAR = "bar";
private String bar = "bar";
public Foo() {
}
public Foo bar(String bar) {
this.bar = bar;
return this;
}
/**
* Get bar
* @return bar
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_BAR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getBar() {
return bar;
}
@JsonProperty(JSON_PROPERTY_BAR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setBar(String bar) {
this.bar = bar;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Foo foo = (Foo) o;
return Objects.equals(this.bar, foo.bar);
}
@Override
public int hashCode() {
return Objects.hash(bar);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Foo {\n");
sb.append(" bar: ").append(toIndentedString(bar)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,105 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Foo;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* FooGetDefaultResponse
*/
@JsonPropertyOrder({
FooGetDefaultResponse.JSON_PROPERTY_STRING
})
@JsonTypeName("_foo_get_default_response")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class FooGetDefaultResponse {
public static final String JSON_PROPERTY_STRING = "string";
private Foo string;
public FooGetDefaultResponse() {
}
public FooGetDefaultResponse string(Foo string) {
this.string = string;
return this;
}
/**
* Get string
* @return string
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Foo getString() {
return string;
}
@JsonProperty(JSON_PROPERTY_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setString(Foo string) {
this.string = string;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o;
return Objects.equals(this.string, fooGetDefaultResponse.string);
}
@Override
public int hashCode() {
return Objects.hash(string);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FooGetDefaultResponse {\n");
sb.append(" string: ").append(toIndentedString(string)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,126 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
*/
@JsonPropertyOrder({
HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class HealthCheckResult {
public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage";
private JsonNullable<String> nullableMessage = JsonNullable.<String>undefined();
public HealthCheckResult() {
}
public HealthCheckResult nullableMessage(String nullableMessage) {
this.nullableMessage = JsonNullable.<String>of(nullableMessage);
return this;
}
/**
* Get nullableMessage
* @return nullableMessage
**/
@javax.annotation.Nullable
@JsonIgnore
public String getNullableMessage() {
return nullableMessage.orElse(null);
}
@JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<String> getNullableMessage_JsonNullable() {
return nullableMessage;
}
@JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE)
public void setNullableMessage_JsonNullable(JsonNullable<String> nullableMessage) {
this.nullableMessage = nullableMessage;
}
public void setNullableMessage(String nullableMessage) {
this.nullableMessage = JsonNullable.<String>of(nullableMessage);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
HealthCheckResult healthCheckResult = (HealthCheckResult) o;
return equalsNullable(this.nullableMessage, healthCheckResult.nullableMessage);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(hashCodeNullable(nullableMessage));
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class HealthCheckResult {\n");
sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,625 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* NullableClass
*/
@JsonPropertyOrder({
NullableClass.JSON_PROPERTY_INTEGER_PROP,
NullableClass.JSON_PROPERTY_NUMBER_PROP,
NullableClass.JSON_PROPERTY_BOOLEAN_PROP,
NullableClass.JSON_PROPERTY_STRING_PROP,
NullableClass.JSON_PROPERTY_DATE_PROP,
NullableClass.JSON_PROPERTY_DATETIME_PROP,
NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP,
NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP,
NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE,
NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP,
NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP,
NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class NullableClass extends HashMap<String, Object> {
public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop";
private JsonNullable<Integer> integerProp = JsonNullable.<Integer>undefined();
public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop";
private JsonNullable<BigDecimal> numberProp = JsonNullable.<BigDecimal>undefined();
public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop";
private JsonNullable<Boolean> booleanProp = JsonNullable.<Boolean>undefined();
public static final String JSON_PROPERTY_STRING_PROP = "string_prop";
private JsonNullable<String> stringProp = JsonNullable.<String>undefined();
public static final String JSON_PROPERTY_DATE_PROP = "date_prop";
private JsonNullable<LocalDate> dateProp = JsonNullable.<LocalDate>undefined();
public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop";
private JsonNullable<OffsetDateTime> datetimeProp = JsonNullable.<OffsetDateTime>undefined();
public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop";
private JsonNullable<List<Object>> arrayNullableProp = JsonNullable.<List<Object>>undefined();
public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop";
private JsonNullable<List<Object>> arrayAndItemsNullableProp = JsonNullable.<List<Object>>undefined();
public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable";
private List<Object> arrayItemsNullable;
public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop";
private JsonNullable<Map<String, Object>> objectNullableProp = JsonNullable.<Map<String, Object>>undefined();
public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop";
private JsonNullable<Map<String, Object>> objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>undefined();
public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable";
private Map<String, Object> objectItemsNullable = new HashMap<>();
public NullableClass() {
}
public NullableClass integerProp(Integer integerProp) {
this.integerProp = JsonNullable.<Integer>of(integerProp);
return this;
}
/**
* Get integerProp
* @return integerProp
**/
@javax.annotation.Nullable
@JsonIgnore
public Integer getIntegerProp() {
return integerProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_INTEGER_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Integer> getIntegerProp_JsonNullable() {
return integerProp;
}
@JsonProperty(JSON_PROPERTY_INTEGER_PROP)
public void setIntegerProp_JsonNullable(JsonNullable<Integer> integerProp) {
this.integerProp = integerProp;
}
public void setIntegerProp(Integer integerProp) {
this.integerProp = JsonNullable.<Integer>of(integerProp);
}
public NullableClass numberProp(BigDecimal numberProp) {
this.numberProp = JsonNullable.<BigDecimal>of(numberProp);
return this;
}
/**
* Get numberProp
* @return numberProp
**/
@javax.annotation.Nullable
@JsonIgnore
public BigDecimal getNumberProp() {
return numberProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_NUMBER_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<BigDecimal> getNumberProp_JsonNullable() {
return numberProp;
}
@JsonProperty(JSON_PROPERTY_NUMBER_PROP)
public void setNumberProp_JsonNullable(JsonNullable<BigDecimal> numberProp) {
this.numberProp = numberProp;
}
public void setNumberProp(BigDecimal numberProp) {
this.numberProp = JsonNullable.<BigDecimal>of(numberProp);
}
public NullableClass booleanProp(Boolean booleanProp) {
this.booleanProp = JsonNullable.<Boolean>of(booleanProp);
return this;
}
/**
* Get booleanProp
* @return booleanProp
**/
@javax.annotation.Nullable
@JsonIgnore
public Boolean getBooleanProp() {
return booleanProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_BOOLEAN_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Boolean> getBooleanProp_JsonNullable() {
return booleanProp;
}
@JsonProperty(JSON_PROPERTY_BOOLEAN_PROP)
public void setBooleanProp_JsonNullable(JsonNullable<Boolean> booleanProp) {
this.booleanProp = booleanProp;
}
public void setBooleanProp(Boolean booleanProp) {
this.booleanProp = JsonNullable.<Boolean>of(booleanProp);
}
public NullableClass stringProp(String stringProp) {
this.stringProp = JsonNullable.<String>of(stringProp);
return this;
}
/**
* Get stringProp
* @return stringProp
**/
@javax.annotation.Nullable
@JsonIgnore
public String getStringProp() {
return stringProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_STRING_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<String> getStringProp_JsonNullable() {
return stringProp;
}
@JsonProperty(JSON_PROPERTY_STRING_PROP)
public void setStringProp_JsonNullable(JsonNullable<String> stringProp) {
this.stringProp = stringProp;
}
public void setStringProp(String stringProp) {
this.stringProp = JsonNullable.<String>of(stringProp);
}
public NullableClass dateProp(LocalDate dateProp) {
this.dateProp = JsonNullable.<LocalDate>of(dateProp);
return this;
}
/**
* Get dateProp
* @return dateProp
**/
@javax.annotation.Nullable
@JsonIgnore
public LocalDate getDateProp() {
return dateProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_DATE_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<LocalDate> getDateProp_JsonNullable() {
return dateProp;
}
@JsonProperty(JSON_PROPERTY_DATE_PROP)
public void setDateProp_JsonNullable(JsonNullable<LocalDate> dateProp) {
this.dateProp = dateProp;
}
public void setDateProp(LocalDate dateProp) {
this.dateProp = JsonNullable.<LocalDate>of(dateProp);
}
public NullableClass datetimeProp(OffsetDateTime datetimeProp) {
this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp);
return this;
}
/**
* Get datetimeProp
* @return datetimeProp
**/
@javax.annotation.Nullable
@JsonIgnore
public OffsetDateTime getDatetimeProp() {
return datetimeProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_DATETIME_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<OffsetDateTime> getDatetimeProp_JsonNullable() {
return datetimeProp;
}
@JsonProperty(JSON_PROPERTY_DATETIME_PROP)
public void setDatetimeProp_JsonNullable(JsonNullable<OffsetDateTime> datetimeProp) {
this.datetimeProp = datetimeProp;
}
public void setDatetimeProp(OffsetDateTime datetimeProp) {
this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp);
}
public NullableClass arrayNullableProp(List<Object> arrayNullableProp) {
this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp);
return this;
}
public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) {
if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) {
this.arrayNullableProp = JsonNullable.<List<Object>>of(new ArrayList<>());
}
try {
this.arrayNullableProp.get().add(arrayNullablePropItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Get arrayNullableProp
* @return arrayNullableProp
**/
@javax.annotation.Nullable
@JsonIgnore
public List<Object> getArrayNullableProp() {
return arrayNullableProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<List<Object>> getArrayNullableProp_JsonNullable() {
return arrayNullableProp;
}
@JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP)
public void setArrayNullableProp_JsonNullable(JsonNullable<List<Object>> arrayNullableProp) {
this.arrayNullableProp = arrayNullableProp;
}
public void setArrayNullableProp(List<Object> arrayNullableProp) {
this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp);
}
public NullableClass arrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) {
this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp);
return this;
}
public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) {
if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) {
this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(new ArrayList<>());
}
try {
this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Get arrayAndItemsNullableProp
* @return arrayAndItemsNullableProp
**/
@javax.annotation.Nullable
@JsonIgnore
public List<Object> getArrayAndItemsNullableProp() {
return arrayAndItemsNullableProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<List<Object>> getArrayAndItemsNullableProp_JsonNullable() {
return arrayAndItemsNullableProp;
}
@JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP)
public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable<List<Object>> arrayAndItemsNullableProp) {
this.arrayAndItemsNullableProp = arrayAndItemsNullableProp;
}
public void setArrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) {
this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp);
}
public NullableClass arrayItemsNullable(List<Object> arrayItemsNullable) {
this.arrayItemsNullable = arrayItemsNullable;
return this;
}
public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) {
if (this.arrayItemsNullable == null) {
this.arrayItemsNullable = new ArrayList<>();
}
this.arrayItemsNullable.add(arrayItemsNullableItem);
return this;
}
/**
* Get arrayItemsNullable
* @return arrayItemsNullable
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Object> getArrayItemsNullable() {
return arrayItemsNullable;
}
@JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setArrayItemsNullable(List<Object> arrayItemsNullable) {
this.arrayItemsNullable = arrayItemsNullable;
}
public NullableClass objectNullableProp(Map<String, Object> objectNullableProp) {
this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp);
return this;
}
public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) {
if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) {
this.objectNullableProp = JsonNullable.<Map<String, Object>>of(new HashMap<>());
}
try {
this.objectNullableProp.get().put(key, objectNullablePropItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Get objectNullableProp
* @return objectNullableProp
**/
@javax.annotation.Nullable
@JsonIgnore
public Map<String, Object> getObjectNullableProp() {
return objectNullableProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Map<String, Object>> getObjectNullableProp_JsonNullable() {
return objectNullableProp;
}
@JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP)
public void setObjectNullableProp_JsonNullable(JsonNullable<Map<String, Object>> objectNullableProp) {
this.objectNullableProp = objectNullableProp;
}
public void setObjectNullableProp(Map<String, Object> objectNullableProp) {
this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp);
}
public NullableClass objectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) {
this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp);
return this;
}
public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) {
if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) {
this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(new HashMap<>());
}
try {
this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Get objectAndItemsNullableProp
* @return objectAndItemsNullableProp
**/
@javax.annotation.Nullable
@JsonIgnore
public Map<String, Object> getObjectAndItemsNullableProp() {
return objectAndItemsNullableProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Map<String, Object>> getObjectAndItemsNullableProp_JsonNullable() {
return objectAndItemsNullableProp;
}
@JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP)
public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable<Map<String, Object>> objectAndItemsNullableProp) {
this.objectAndItemsNullableProp = objectAndItemsNullableProp;
}
public void setObjectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) {
this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp);
}
public NullableClass objectItemsNullable(Map<String, Object> objectItemsNullable) {
this.objectItemsNullable = objectItemsNullable;
return this;
}
public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) {
if (this.objectItemsNullable == null) {
this.objectItemsNullable = new HashMap<>();
}
this.objectItemsNullable.put(key, objectItemsNullableItem);
return this;
}
/**
* Get objectItemsNullable
* @return objectItemsNullable
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public Map<String, Object> getObjectItemsNullable() {
return objectItemsNullable;
}
@JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public void setObjectItemsNullable(Map<String, Object> objectItemsNullable) {
this.objectItemsNullable = objectItemsNullable;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NullableClass nullableClass = (NullableClass) o;
return equalsNullable(this.integerProp, nullableClass.integerProp) &&
equalsNullable(this.numberProp, nullableClass.numberProp) &&
equalsNullable(this.booleanProp, nullableClass.booleanProp) &&
equalsNullable(this.stringProp, nullableClass.stringProp) &&
equalsNullable(this.dateProp, nullableClass.dateProp) &&
equalsNullable(this.datetimeProp, nullableClass.datetimeProp) &&
equalsNullable(this.arrayNullableProp, nullableClass.arrayNullableProp) &&
equalsNullable(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) &&
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
equalsNullable(this.objectNullableProp, nullableClass.objectNullableProp) &&
equalsNullable(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) &&
super.equals(o);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(hashCodeNullable(integerProp), hashCodeNullable(numberProp), hashCodeNullable(booleanProp), hashCodeNullable(stringProp), hashCodeNullable(dateProp), hashCodeNullable(datetimeProp), hashCodeNullable(arrayNullableProp), hashCodeNullable(arrayAndItemsNullableProp), arrayItemsNullable, hashCodeNullable(objectNullableProp), hashCodeNullable(objectAndItemsNullableProp), objectItemsNullable, super.hashCode());
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class NullableClass {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n");
sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n");
sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n");
sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n");
sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n");
sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n");
sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n");
sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n");
sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n");
sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n");
sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n");
sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,218 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.client.model.DeprecatedObject;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* ObjectWithDeprecatedFields
*/
@JsonPropertyOrder({
ObjectWithDeprecatedFields.JSON_PROPERTY_UUID,
ObjectWithDeprecatedFields.JSON_PROPERTY_ID,
ObjectWithDeprecatedFields.JSON_PROPERTY_DEPRECATED_REF,
ObjectWithDeprecatedFields.JSON_PROPERTY_BARS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ObjectWithDeprecatedFields {
public static final String JSON_PROPERTY_UUID = "uuid";
private String uuid;
public static final String JSON_PROPERTY_ID = "id";
private BigDecimal id;
public static final String JSON_PROPERTY_DEPRECATED_REF = "deprecatedRef";
private DeprecatedObject deprecatedRef;
public static final String JSON_PROPERTY_BARS = "bars";
private List<String> bars;
public ObjectWithDeprecatedFields() {
}
public ObjectWithDeprecatedFields uuid(String uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_UUID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getUuid() {
return uuid;
}
@JsonProperty(JSON_PROPERTY_UUID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUuid(String uuid) {
this.uuid = uuid;
}
public ObjectWithDeprecatedFields id(BigDecimal id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
* @deprecated
**/
@Deprecated
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public BigDecimal getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(BigDecimal id) {
this.id = id;
}
public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) {
this.deprecatedRef = deprecatedRef;
return this;
}
/**
* Get deprecatedRef
* @return deprecatedRef
* @deprecated
**/
@Deprecated
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DEPRECATED_REF)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public DeprecatedObject getDeprecatedRef() {
return deprecatedRef;
}
@JsonProperty(JSON_PROPERTY_DEPRECATED_REF)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDeprecatedRef(DeprecatedObject deprecatedRef) {
this.deprecatedRef = deprecatedRef;
}
public ObjectWithDeprecatedFields bars(List<String> bars) {
this.bars = bars;
return this;
}
public ObjectWithDeprecatedFields addBarsItem(String barsItem) {
if (this.bars == null) {
this.bars = new ArrayList<>();
}
this.bars.add(barsItem);
return this;
}
/**
* Get bars
* @return bars
* @deprecated
**/
@Deprecated
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_BARS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<String> getBars() {
return bars;
}
@JsonProperty(JSON_PROPERTY_BARS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setBars(List<String> bars) {
this.bars = bars;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o;
return Objects.equals(this.uuid, objectWithDeprecatedFields.uuid) &&
Objects.equals(this.id, objectWithDeprecatedFields.id) &&
Objects.equals(this.deprecatedRef, objectWithDeprecatedFields.deprecatedRef) &&
Objects.equals(this.bars, objectWithDeprecatedFields.bars);
}
@Override
public int hashCode() {
return Objects.hash(uuid, id, deprecatedRef, bars);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ObjectWithDeprecatedFields {\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n");
sb.append(" bars: ").append(toIndentedString(bars)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Gets or Sets OuterEnumDefaultValue
*/
public enum OuterEnumDefaultValue {
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");
private String value;
OuterEnumDefaultValue(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static OuterEnumDefaultValue fromValue(String value) {
for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Gets or Sets OuterEnumInteger
*/
public enum OuterEnumInteger {
NUMBER_0(0),
NUMBER_1(1),
NUMBER_2(2);
private Integer value;
OuterEnumInteger(Integer value) {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static OuterEnumInteger fromValue(Integer value) {
for (OuterEnumInteger b : OuterEnumInteger.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Gets or Sets OuterEnumIntegerDefaultValue
*/
public enum OuterEnumIntegerDefaultValue {
NUMBER_0(0),
NUMBER_1(1),
NUMBER_2(2);
private Integer value;
OuterEnumIntegerDefaultValue(Integer value) {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static OuterEnumIntegerDefaultValue fromValue(Integer value) {
for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@ -0,0 +1,104 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.OuterEnumInteger;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* OuterObjectWithEnumProperty
*/
@JsonPropertyOrder({
OuterObjectWithEnumProperty.JSON_PROPERTY_VALUE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class OuterObjectWithEnumProperty {
public static final String JSON_PROPERTY_VALUE = "value";
private OuterEnumInteger value;
public OuterObjectWithEnumProperty() {
}
public OuterObjectWithEnumProperty value(OuterEnumInteger value) {
this.value = value;
return this;
}
/**
* Get value
* @return value
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public OuterEnumInteger getValue() {
return value;
}
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setValue(OuterEnumInteger value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o;
return Objects.equals(this.value, outerObjectWithEnumProperty.value);
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OuterObjectWithEnumProperty {\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,59 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Gets or Sets SingleRefType
*/
public enum SingleRefType {
ADMIN("admin"),
USER("user");
private String value;
SingleRefType(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static SingleRefType fromValue(String value) {
for (SingleRefType b : SingleRefType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -14,10 +14,13 @@
package org.openapitools.client.api;
import org.openapitools.client.model.Client;
import java.util.UUID;
import org.junit.Test;
import org.junit.Ignore;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -42,8 +45,9 @@ public class AnotherFakeApiTest {
*/
@Test
public void call123testSpecialTagsTest() throws IOException {
Client client = null;
Client response = api.call123testSpecialTags(client);
UUID uuidTest = null;
Client body = null;
Client response = api.call123testSpecialTags(uuidTest, body);
// TODO: test validations
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -21,10 +21,13 @@ import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import org.junit.Test;
import org.junit.Ignore;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -39,6 +42,22 @@ public class FakeApiTest {
private final FakeApi api = new FakeApi();
/**
* creates an XmlItem
*
* this route creates an XmlItem
*
* @throws IOException
* if the Api call fails
*/
@Test
public void createXmlItemTest() throws IOException {
XmlItem xmlItem = null;
api.createXmlItem(xmlItem);
// TODO: test validations
}
/**
*
*
@ -65,8 +84,8 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterCompositeSerializeTest() throws IOException {
OuterComposite outerComposite = null;
OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite);
OuterComposite body = null;
OuterComposite response = api.fakeOuterCompositeSerialize(body);
// TODO: test validations
}
@ -113,8 +132,8 @@ public class FakeApiTest {
*/
@Test
public void testBodyWithFileSchemaTest() throws IOException {
FileSchemaTestClass fileSchemaTestClass = null;
api.testBodyWithFileSchema(fileSchemaTestClass);
FileSchemaTestClass body = null;
api.testBodyWithFileSchema(body);
// TODO: test validations
}
@ -130,8 +149,8 @@ public class FakeApiTest {
@Test
public void testBodyWithQueryParamsTest() throws IOException {
String query = null;
User user = null;
api.testBodyWithQueryParams(query, user);
User body = null;
api.testBodyWithQueryParams(query, body);
// TODO: test validations
}
@ -146,16 +165,16 @@ public class FakeApiTest {
*/
@Test
public void testClientModelTest() throws IOException {
Client client = null;
Client response = api.testClientModel(client);
Client body = null;
Client response = api.testClientModel(body);
// TODO: test validations
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @throws IOException
* if the Api call fails
@ -235,8 +254,8 @@ public class FakeApiTest {
*/
@Test
public void testInlineAdditionalPropertiesTest() throws IOException {
Map<String, String> requestBody = null;
api.testInlineAdditionalProperties(requestBody);
Map<String, String> param = null;
api.testInlineAdditionalProperties(param);
// TODO: test validations
}
@ -258,4 +277,24 @@ public class FakeApiTest {
// TODO: test validations
}
/**
*
*
* To test the collection format in query parameters
*
* @throws IOException
* if the Api call fails
*/
@Test
public void testQueryParameterCollectionFormatTest() throws IOException {
List<String> pipe = null;
List<String> ioutil = null;
List<String> http = null;
List<String> url = null;
List<String> context = null;
api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
// TODO: test validations
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -18,6 +18,8 @@ import org.junit.Test;
import org.junit.Ignore;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -42,8 +44,8 @@ public class FakeClassnameTags123ApiTest {
*/
@Test
public void testClassnameTest() throws IOException {
Client client = null;
Client response = api.testClassname(client);
Client body = null;
Client response = api.testClassname(body);
// TODO: test validations
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -16,15 +16,17 @@ package org.openapitools.client.api;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import org.junit.Test;
import org.junit.Ignore;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* API tests for PetApi
@ -45,8 +47,8 @@ public class PetApiTest {
*/
@Test
public void addPetTest() throws IOException {
Pet pet = null;
api.addPet(pet);
Pet body = null;
api.addPet(body);
// TODO: test validations
}
@ -126,8 +128,8 @@ public class PetApiTest {
*/
@Test
public void updatePetTest() throws IOException {
Pet pet = null;
api.updatePet(pet);
Pet body = null;
api.updatePet(body);
// TODO: test validations
}
@ -162,8 +164,26 @@ public class PetApiTest {
public void uploadFileTest() throws IOException {
Long petId = null;
String additionalMetadata = null;
File file = null;
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
File _file = null;
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file);
// TODO: test validations
}
/**
* uploads an image (required)
*
*
*
* @throws IOException
* if the Api call fails
*/
@Test
public void uploadFileWithRequiredFileTest() throws IOException {
Long petId = null;
File requiredFile = null;
String additionalMetadata = null;
ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
// TODO: test validations
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -18,6 +18,8 @@ import org.junit.Test;
import org.junit.Ignore;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -89,8 +91,8 @@ public class StoreApiTest {
*/
@Test
public void placeOrderTest() throws IOException {
Order order = null;
Order response = api.placeOrder(order);
Order body = null;
Order response = api.placeOrder(body);
// TODO: test validations
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -13,11 +13,14 @@
package org.openapitools.client.api;
import java.time.OffsetDateTime;
import org.openapitools.client.model.User;
import org.junit.Test;
import org.junit.Ignore;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -42,8 +45,8 @@ public class UserApiTest {
*/
@Test
public void createUserTest() throws IOException {
User user = null;
api.createUser(user);
User body = null;
api.createUser(body);
// TODO: test validations
}
@ -58,8 +61,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithArrayInputTest() throws IOException {
List<User> user = null;
api.createUsersWithArrayInput(user);
List<User> body = null;
api.createUsersWithArrayInput(body);
// TODO: test validations
}
@ -74,8 +77,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithListInputTest() throws IOException {
List<User> user = null;
api.createUsersWithListInput(user);
List<User> body = null;
api.createUsersWithListInput(body);
// TODO: test validations
}
@ -155,8 +158,8 @@ public class UserApiTest {
@Test
public void updateUserTest() throws IOException {
String username = null;
User user = null;
api.updateUser(username, user);
User body = null;
api.updateUser(username, body);
// TODO: test validations
}

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesAnyType
*/

View File

@ -25,7 +25,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesArray
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesBoolean
*/

View File

@ -26,7 +26,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesClass
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesInteger
*/

View File

@ -25,7 +25,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesNumber
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesObject
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesString
*/

View File

@ -21,14 +21,10 @@ import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.BigCat;
import org.openapitools.client.model.Cat;
import org.openapitools.client.model.Dog;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Animal
*/

View File

@ -20,12 +20,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ArrayOfArrayOfNumberOnly
*/

View File

@ -20,12 +20,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ArrayOfNumberOnly
*/

View File

@ -19,13 +19,13 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.client.model.ReadOnlyFirst;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ArrayTest
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Capitalization
*/

View File

@ -22,12 +22,10 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Animal;
import org.openapitools.client.model.BigCat;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Cat
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Category
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ClassModel
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Client
*/

View File

@ -26,7 +26,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Dog
*/

View File

@ -19,12 +19,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for EnumArrays
*/

View File

@ -17,7 +17,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for EnumClass
*/

View File

@ -23,7 +23,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for EnumTest
*/

View File

@ -19,13 +19,13 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.client.model.ModelFile;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for FileSchemaTestClass
*/

View File

@ -27,7 +27,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for FormatTest
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for HasOnlyReadOnly
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for MapTest
*/

View File

@ -27,7 +27,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for MixedPropertiesAndAdditionalPropertiesClass
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Model200Response
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ModelApiResponse
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ModelFile
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ModelList
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ModelReturn
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Name
*/

View File

@ -23,7 +23,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for NumberOnly
*/

View File

@ -23,7 +23,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Order
*/

View File

@ -23,7 +23,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for OuterComposite
*/

View File

@ -17,7 +17,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for OuterEnum
*/

View File

@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@ -29,7 +30,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Pet
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ReadOnlyFirst
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for SpecialModelName
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Tag
*/

View File

@ -20,12 +20,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for TypeHolderDefault
*/

View File

@ -20,12 +20,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for TypeHolderExample
*/

View File

@ -22,7 +22,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for User
*/

View File

@ -20,12 +20,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for XmlItem
*/

View File

@ -1,291 +0,0 @@
package org.openapitools.client;
import org.openapitools.client.auth.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiClientTest {
ApiClient apiClient = null;
@Before
public void setup() {
apiClient = new ApiClient();
}
@Test
public void testParseAndFormatDate() {
// default date format
String dateStr = "2015-11-07T03:49:09.356+00:00";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
// custom date format: without milli-seconds, custom time zone
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
apiClient.setDateFormat(format);
dateStr = "2015-11-07T13:49:09+10:00";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
}
@Test
public void testIsJsonMime() {
assertFalse(apiClient.isJsonMime(null));
assertFalse(apiClient.isJsonMime(""));
assertFalse(apiClient.isJsonMime("text/plain"));
assertFalse(apiClient.isJsonMime("application/xml"));
assertFalse(apiClient.isJsonMime("application/jsonp"));
assertFalse(apiClient.isJsonMime("example/json"));
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
assertTrue(apiClient.isJsonMime("application/json"));
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
assertTrue(apiClient.isJsonMime("application/problem+json"));
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
assertTrue(apiClient.isJsonMime("application/json\t"));
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
}
@Test
public void testSelectHeaderAccept() {
String[] accepts = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{};
assertNull(apiClient.selectHeaderAccept(accepts));
}
@Test
public void testSelectHeaderContentType() {
String[] contentTypes = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
}
@Test
public void testGetAuthentications() {
Map<String, Authentication> auths = apiClient.getAuthentications();
Authentication auth = auths.get("api_key");
assertNotNull(auth);
assertTrue(auth instanceof ApiKeyAuth);
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
assertEquals("header", apiKeyAuth.getLocation());
assertEquals("api_key", apiKeyAuth.getParamName());
auth = auths.get("petstore_auth");
assertTrue(auth instanceof OAuth);
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
assertNull(auths.get("unknown"));
try {
auths.put("my_auth", new HttpBasicAuth());
fail("the authentications returned should not be modifiable");
} catch (UnsupportedOperationException e) {
}
}
@Test
public void testSetUsernameAndPassword() {
HttpBasicAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof HttpBasicAuth) {
auth = (HttpBasicAuth) _auth;
break;
}
}
auth.setUsername(null);
auth.setPassword(null);
apiClient.setUsername("my-username");
apiClient.setPassword("my-password");
assertEquals("my-username", auth.getUsername());
assertEquals("my-password", auth.getPassword());
// reset values
auth.setUsername(null);
auth.setPassword(null);
}
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
apiClient.setApiKey("my-api-key");
apiClient.setApiKeyPrefix("Token");
assertEquals("my-api-key", auth.getApiKey());
assertEquals("Token", auth.getApiKeyPrefix());
// reset values
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
}
@Test
public void testParameterToPairWhenNameIsInvalid() throws Exception {
List<Pair> pairs_a = apiClient.parameterToPair(null, new Integer(1));
List<Pair> pairs_b = apiClient.parameterToPair("", new Integer(1));
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPair("param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairWhenValueIsEmptyString() throws Exception {
// single empty string
List<Pair> pairs = apiClient.parameterToPair("param-a", " ");
assertEquals(1, pairs.size());
}
@Test
public void testParameterToPairWhenValueIsNotCollection() throws Exception {
String name = "param-a";
Integer value = 1;
List<Pair> pairs = apiClient.parameterToPair(name, value);
assertEquals(1, pairs.size());
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
}
@Test
public void testParameterToPairWhenValueIsCollection() throws Exception {
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
List<Pair> pairs = apiClient.parameterToPair("param-a", values);
assertEquals(0, pairs.size());
}
@Test
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
List<Integer> objects = new ArrayList<Integer>();
objects.add(new Integer(1));
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, objects);
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", objects);
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
// list of empty strings
List<String> strs = new ArrayList<String>();
strs.add(" ");
strs.add(" ");
strs.add(" ");
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
assertEquals(1, concatStrings.size());
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
}
@Test
public void testParameterToPairsWhenValueIsCollection() throws Exception {
Map<String, String> collectionFormatMap = new HashMap<String, String>();
collectionFormatMap.put("csv", ",");
collectionFormatMap.put("tsv", "\t");
collectionFormatMap.put("ssv", " ");
collectionFormatMap.put("pipes", "|");
collectionFormatMap.put("", ","); // no format, must default to csv
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
String name = "param-a";
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
// check for multi separately
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
assertEquals(values.size(), multiPairs.size());
for (int i = 0; i < values.size(); i++) {
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), multiPairs.get(i).getValue());
}
// all other formats
for (String collectionFormat : collectionFormatMap.keySet()) {
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
assertEquals(1, pairs.size());
String delimiter = collectionFormatMap.get(collectionFormat);
if (!delimiter.equals(",")) {
// commas are not escaped because they are reserved characters in URIs
delimiter = apiClient.escapeString(delimiter);
}
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
// must equal input values
assertEquals(values.size(), pairValueSplit.length);
for (int i = 0; i < values.size(); i++) {
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), pairValueSplit[i]);
}
}
}
}

View File

@ -1,15 +0,0 @@
package org.openapitools.client;
import org.junit.*;
import static org.junit.Assert.*;
public class ConfigurationTest {
@Test
public void testDefaultApiClient() {
ApiClient apiClient = Configuration.getDefaultApiClient();
assertNotNull(apiClient);
assertEquals("http://petstore.swagger.io:80/v2", apiClient.getBasePath());
assertFalse(apiClient.isDebugging());
}
}

View File

@ -1,33 +0,0 @@
package org.openapitools.client;
import org.junit.*;
import static org.junit.Assert.*;
public class StringUtilTest {
@Test
public void testContainsIgnoreCase() {
assertTrue(StringUtil.containsIgnoreCase(new String[]{"abc"}, "abc"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{"abc"}, "ABC"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{"ABC"}, "abc"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{null, "abc"}, "ABC"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{null, "abc"}, null));
assertFalse(StringUtil.containsIgnoreCase(new String[]{"abc"}, "def"));
assertFalse(StringUtil.containsIgnoreCase(new String[]{}, "ABC"));
assertFalse(StringUtil.containsIgnoreCase(new String[]{}, null));
}
@Test
public void testJoin() {
String[] array = {"aa", "bb", "cc"};
assertEquals("aa,bb,cc", StringUtil.join(array, ","));
assertEquals("aa, bb, cc", StringUtil.join(array, ", "));
assertEquals("aabbcc", StringUtil.join(array, ""));
assertEquals("aa bb cc", StringUtil.join(array, " "));
assertEquals("aa\nbb\ncc", StringUtil.join(array, "\n"));
assertEquals("", StringUtil.join(new String[]{}, ","));
assertEquals("abc", StringUtil.join(new String[]{"abc"}, ","));
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -15,9 +15,13 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Client;
import java.util.UUID;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,12 +30,10 @@ import java.util.Map;
/**
* API tests for AnotherFakeApi
*/
@Ignore
public class AnotherFakeApiTest {
private final AnotherFakeApi api = new AnotherFakeApi();
/**
* To test special tags
*
@ -42,10 +44,13 @@ public class AnotherFakeApiTest {
*/
@Test
public void call123testSpecialTagsTest() throws ApiException {
Client client = null;
Client response = api.call123testSpecialTags(client);
//
//UUID uuidTest = null;
//
//Client body = null;
//
//Client response = api.call123testSpecialTags(uuidTest, body);
// TODO: test validations
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -18,10 +18,14 @@ import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import java.time.LocalDate;
import java.time.OffsetDateTime;
@ -33,15 +37,28 @@ import java.util.Map;
/**
* API tests for FakeApi
*/
@Ignore
public class FakeApiTest {
private final FakeApi api = new FakeApi();
/**
*
* creates an XmlItem
*
* this route creates an XmlItem
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createXmlItemTest() throws ApiException {
//
//XmlItem xmlItem = null;
//
//api.createXmlItem(xmlItem);
// TODO: test validations
}
/**
* Test serialization of outer boolean types
*
* @throws ApiException
@ -49,15 +66,14 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterBooleanSerializeTest() throws ApiException {
Boolean body = null;
Boolean response = api.fakeOuterBooleanSerialize(body);
//
//Boolean body = null;
//
//Boolean response = api.fakeOuterBooleanSerialize(body);
// TODO: test validations
}
/**
*
*
* Test serialization of object with outer number type
*
* @throws ApiException
@ -65,15 +81,14 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterCompositeSerializeTest() throws ApiException {
OuterComposite outerComposite = null;
OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite);
//
//OuterComposite body = null;
//
//OuterComposite response = api.fakeOuterCompositeSerialize(body);
// TODO: test validations
}
/**
*
*
* Test serialization of outer number types
*
* @throws ApiException
@ -81,15 +96,14 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterNumberSerializeTest() throws ApiException {
BigDecimal body = null;
BigDecimal response = api.fakeOuterNumberSerialize(body);
//
//BigDecimal body = null;
//
//BigDecimal response = api.fakeOuterNumberSerialize(body);
// TODO: test validations
}
/**
*
*
* Test serialization of outer string types
*
* @throws ApiException
@ -97,15 +111,14 @@ public class FakeApiTest {
*/
@Test
public void fakeOuterStringSerializeTest() throws ApiException {
String body = null;
String response = api.fakeOuterStringSerialize(body);
//
//String body = null;
//
//String response = api.fakeOuterStringSerialize(body);
// TODO: test validations
}
/**
*
*
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @throws ApiException
@ -113,29 +126,28 @@ public class FakeApiTest {
*/
@Test
public void testBodyWithFileSchemaTest() throws ApiException {
FileSchemaTestClass fileSchemaTestClass = null;
api.testBodyWithFileSchema(fileSchemaTestClass);
//
//FileSchemaTestClass body = null;
//
//api.testBodyWithFileSchema(body);
// TODO: test validations
}
/**
*
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testBodyWithQueryParamsTest() throws ApiException {
String query = null;
User user = null;
api.testBodyWithQueryParams(query, user);
//
//String query = null;
//
//User body = null;
//
//api.testBodyWithQueryParams(query, body);
// TODO: test validations
}
/**
* To test \&quot;client\&quot; model
*
@ -146,41 +158,56 @@ public class FakeApiTest {
*/
@Test
public void testClientModelTest() throws ApiException {
Client client = null;
Client response = api.testClientModel(client);
//
//Client body = null;
//
//Client response = api.testClientModel(body);
// TODO: test validations
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testEndpointParametersTest() throws ApiException {
BigDecimal number = null;
Double _double = null;
String patternWithoutDelimiter = null;
byte[] _byte = null;
Integer integer = null;
Integer int32 = null;
Long int64 = null;
Float _float = null;
String string = null;
File binary = null;
LocalDate date = null;
OffsetDateTime dateTime = null;
String password = null;
String paramCallback = null;
api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
//
//BigDecimal number = null;
//
//Double _double = null;
//
//String patternWithoutDelimiter = null;
//
//byte[] _byte = null;
//
//Integer integer = null;
//
//Integer int32 = null;
//
//Long int64 = null;
//
//Float _float = null;
//
//String string = null;
//
//File binary = null;
//
//LocalDate date = null;
//
//OffsetDateTime dateTime = null;
//
//String password = null;
//
//String paramCallback = null;
//
//api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
// TODO: test validations
}
/**
* To test enum parameters
*
@ -191,19 +218,27 @@ public class FakeApiTest {
*/
@Test
public void testEnumParametersTest() throws ApiException {
List<String> enumHeaderStringArray = null;
String enumHeaderString = null;
List<String> enumQueryStringArray = null;
String enumQueryString = null;
Integer enumQueryInteger = null;
Double enumQueryDouble = null;
List<String> enumFormStringArray = null;
String enumFormString = null;
api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
//
//List<String> enumHeaderStringArray = null;
//
//String enumHeaderString = null;
//
//List<String> enumQueryStringArray = null;
//
//String enumQueryString = null;
//
//Integer enumQueryInteger = null;
//
//Double enumQueryDouble = null;
//
//List<String> enumFormStringArray = null;
//
//String enumFormString = null;
//
//api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
// TODO: test validations
}
/**
* Fake endpoint to test group parameters (optional)
*
@ -214,48 +249,76 @@ public class FakeApiTest {
*/
@Test
public void testGroupParametersTest() throws ApiException {
Integer requiredStringGroup = null;
Boolean requiredBooleanGroup = null;
Long requiredInt64Group = null;
Integer stringGroup = null;
Boolean booleanGroup = null;
Long int64Group = null;
api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
//
//Integer requiredStringGroup = null;
//
//Boolean requiredBooleanGroup = null;
//
//Long requiredInt64Group = null;
//
//Integer stringGroup = null;
//
//Boolean booleanGroup = null;
//
//Long int64Group = null;
//
//api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
// TODO: test validations
}
/**
* test inline additionalProperties
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testInlineAdditionalPropertiesTest() throws ApiException {
Map<String, String> requestBody = null;
api.testInlineAdditionalProperties(requestBody);
//
//Map<String, String> param = null;
//
//api.testInlineAdditionalProperties(param);
// TODO: test validations
}
/**
* test json serialization of form data
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testJsonFormDataTest() throws ApiException {
String param = null;
String param2 = null;
api.testJsonFormData(param, param2);
//
//String param = null;
//
//String param2 = null;
//
//api.testJsonFormData(param, param2);
// TODO: test validations
}
/**
* To test the collection format in query parameters
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testQueryParameterCollectionFormatTest() throws ApiException {
//
//List<String> pipe = null;
//
//List<String> ioutil = null;
//
//List<String> http = null;
//
//List<String> url = null;
//
//List<String> context = null;
//
//api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
// TODO: test validations
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -17,7 +17,10 @@ import org.openapitools.client.ApiException;
import org.openapitools.client.model.Client;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,12 +29,10 @@ import java.util.Map;
/**
* API tests for FakeClassnameTags123Api
*/
@Ignore
public class FakeClassnameTags123ApiTest {
private final FakeClassnameTags123Api api = new FakeClassnameTags123Api();
/**
* To test class name in snake case
*
@ -42,10 +43,11 @@ public class FakeClassnameTags123ApiTest {
*/
@Test
public void testClassnameTest() throws ApiException {
Client client = null;
Client response = api.testClassname(client);
//
//Client body = null;
//
//Client response = api.testClassname(body);
// TODO: test validations
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -17,57 +17,57 @@ import org.openapitools.client.ApiException;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* API tests for PetApi
*/
@Ignore
public class PetApiTest {
private final PetApi api = new PetApi();
/**
* Add a new pet to the store
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void addPetTest() throws ApiException {
Pet pet = null;
api.addPet(pet);
//
//Pet body = null;
//
//api.addPet(body);
// TODO: test validations
}
/**
* Deletes a pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deletePetTest() throws ApiException {
Long petId = null;
String apiKey = null;
api.deletePet(petId, apiKey);
//
//Long petId = null;
//
//String apiKey = null;
//
//api.deletePet(petId, apiKey);
// TODO: test validations
}
/**
* Finds Pets by status
*
@ -78,12 +78,13 @@ public class PetApiTest {
*/
@Test
public void findPetsByStatusTest() throws ApiException {
List<String> status = null;
List<Pet> response = api.findPetsByStatus(status);
//
//List<String> status = null;
//
//List<Pet> response = api.findPetsByStatus(status);
// TODO: test validations
}
/**
* Finds Pets by tags
*
@ -94,12 +95,13 @@ public class PetApiTest {
*/
@Test
public void findPetsByTagsTest() throws ApiException {
Set<String> tags = null;
Set<Pet> response = api.findPetsByTags(tags);
//
//Set<String> tags = null;
//
//Set<Pet> response = api.findPetsByTags(tags);
// TODO: test validations
}
/**
* Find pet by ID
*
@ -110,62 +112,83 @@ public class PetApiTest {
*/
@Test
public void getPetByIdTest() throws ApiException {
Long petId = null;
Pet response = api.getPetById(petId);
//
//Long petId = null;
//
//Pet response = api.getPetById(petId);
// TODO: test validations
}
/**
* Update an existing pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetTest() throws ApiException {
Pet pet = null;
api.updatePet(pet);
//
//Pet body = null;
//
//api.updatePet(body);
// TODO: test validations
}
/**
* Updates a pet in the store with form data
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetWithFormTest() throws ApiException {
Long petId = null;
String name = null;
String status = null;
api.updatePetWithForm(petId, name, status);
//
//Long petId = null;
//
//String name = null;
//
//String status = null;
//
//api.updatePetWithForm(petId, name, status);
// TODO: test validations
}
/**
* uploads an image
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileTest() throws ApiException {
Long petId = null;
String additionalMetadata = null;
File file = null;
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
//
//Long petId = null;
//
//String additionalMetadata = null;
//
//File _file = null;
//
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file);
// TODO: test validations
}
/**
* uploads an image (required)
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileWithRequiredFileTest() throws ApiException {
//
//Long petId = null;
//
//File requiredFile = null;
//
//String additionalMetadata = null;
//
//ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
// TODO: test validations
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -17,7 +17,10 @@ import org.openapitools.client.ApiException;
import org.openapitools.client.model.Order;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,12 +29,10 @@ import java.util.Map;
/**
* API tests for StoreApi
*/
@Ignore
public class StoreApiTest {
private final StoreApi api = new StoreApi();
/**
* Delete purchase order by ID
*
@ -42,12 +43,13 @@ public class StoreApiTest {
*/
@Test
public void deleteOrderTest() throws ApiException {
String orderId = null;
api.deleteOrder(orderId);
//
//String orderId = null;
//
//api.deleteOrder(orderId);
// TODO: test validations
}
/**
* Returns pet inventories by status
*
@ -58,11 +60,11 @@ public class StoreApiTest {
*/
@Test
public void getInventoryTest() throws ApiException {
Map<String, Integer> response = api.getInventory();
//
//Map<String, Integer> response = api.getInventory();
// TODO: test validations
}
/**
* Find purchase order by ID
*
@ -73,26 +75,26 @@ public class StoreApiTest {
*/
@Test
public void getOrderByIdTest() throws ApiException {
Long orderId = null;
Order response = api.getOrderById(orderId);
//
//Long orderId = null;
//
//Order response = api.getOrderById(orderId);
// TODO: test validations
}
/**
* Place an order for a pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void placeOrderTest() throws ApiException {
Order order = null;
Order response = api.placeOrder(order);
//
//Order body = null;
//
//Order response = api.placeOrder(body);
// TODO: test validations
}
}

View File

@ -2,7 +2,7 @@
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@ -14,10 +14,14 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import java.time.OffsetDateTime;
import org.openapitools.client.model.User;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,12 +30,10 @@ import java.util.Map;
/**
* API tests for UserApi
*/
@Ignore
public class UserApiTest {
private final UserApi api = new UserApi();
/**
* Create user
*
@ -42,44 +44,43 @@ public class UserApiTest {
*/
@Test
public void createUserTest() throws ApiException {
User user = null;
api.createUser(user);
//
//User body = null;
//
//api.createUser(body);
// TODO: test validations
}
/**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithArrayInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithArrayInput(user);
//
//List<User> body = null;
//
//api.createUsersWithArrayInput(body);
// TODO: test validations
}
/**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithListInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithListInput(user);
//
//List<User> body = null;
//
//api.createUsersWithListInput(body);
// TODO: test validations
}
/**
* Delete user
*
@ -90,60 +91,58 @@ public class UserApiTest {
*/
@Test
public void deleteUserTest() throws ApiException {
String username = null;
api.deleteUser(username);
//
//String username = null;
//
//api.deleteUser(username);
// TODO: test validations
}
/**
* Get user by user name
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getUserByNameTest() throws ApiException {
String username = null;
User response = api.getUserByName(username);
//
//String username = null;
//
//User response = api.getUserByName(username);
// TODO: test validations
}
/**
* Logs user into the system
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void loginUserTest() throws ApiException {
String username = null;
String password = null;
String response = api.loginUser(username, password);
//
//String username = null;
//
//String password = null;
//
//String response = api.loginUser(username, password);
// TODO: test validations
}
/**
* Logs out current logged in user session
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void logoutUserTest() throws ApiException {
api.logoutUser();
//
//api.logoutUser();
// TODO: test validations
}
/**
* Updated user
*
@ -154,11 +153,13 @@ public class UserApiTest {
*/
@Test
public void updateUserTest() throws ApiException {
String username = null;
User user = null;
api.updateUser(username, user);
//
//String username = null;
//
//User body = null;
//
//api.updateUser(username, body);
// TODO: test validations
}
}

View File

@ -1,71 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiKeyAuthTest {
@Test
public void testApplyToParamsInQuery() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams, cookieParams);
assertEquals(1, queryParams.size());
for (Pair queryParam : queryParams) {
assertEquals("my-api-key", queryParam.getValue());
}
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}
@Test
public void testApplyToParamsInHeaderWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
}
@Test
public void testApplyToParamsInCookieWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or header parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
}
}

View File

@ -1,54 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class HttpBasicAuthTest {
HttpBasicAuth auth = null;
@Before
public void setup() {
auth = new HttpBasicAuth();
}
@Test
public void testApplyToParams() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
assertEquals(expected, headerParams.get("Authorization"));
// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization"));
// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization"));
}
}

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesAnyType
*/

View File

@ -25,7 +25,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesArray
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesBoolean
*/

View File

@ -26,7 +26,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesClass
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesInteger
*/

View File

@ -25,7 +25,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesNumber
*/

View File

@ -24,7 +24,6 @@ import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AdditionalPropertiesObject
*/

Some files were not shown because too many files have changed in this diff Show More