Merge remote-tracking branch 'origin/master' into 5.1.x

This commit is contained in:
William Cheng
2021-01-28 15:52:44 +08:00
2062 changed files with 30059 additions and 34193 deletions

View File

@@ -28,10 +28,13 @@ src/main/java/org/openapitools/client/api/PetApi.java
src/main/java/org/openapitools/client/api/StoreApi.java
src/main/java/org/openapitools/client/api/UserApi.java
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
src/main/java/org/openapitools/client/auth/DefaultApi20Impl.java
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
src/main/java/org/openapitools/client/auth/OAuth.java
src/main/java/org/openapitools/client/auth/OAuthFlow.java
src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java
src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java

View File

@@ -32,6 +32,41 @@ After the client library is installed/deployed, you can use it in your Maven pro
```
And to use the api you can follow the examples bellow:
```java
//Set bearer token manually
ApiClient apiClient = new ApiClient("petstore_auth_client");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setAccessToken("TOKEN", 10000);
//Use api key
ApiClient apiClient = new ApiClient("api_key", "API KEY");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
//Use http basic authentication
ApiClient apiClient = new ApiClient("basicAuth");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setCredentials("username", "password");
//Oauth password
ApiClient apiClient = new ApiClient("oauth_password");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setOauthPassword("username", "password", "client_id", "client_secret");
//Oauth client credentials flow
ApiClient apiClient = new ApiClient("oauth_client_credentials");
apiClient.setBasePath("https://localhost:8243/petstore/1/");
apiClient.setClientCredentials("client_id", "client_secret");
PetApi petApi = apiClient.buildClient(PetApi.class);
Pet petById = petApi.getPetById(12345L);
System.out.println(petById);
}
```
## Recommendation
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
@@ -40,4 +75,3 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea

View File

@@ -33,8 +33,8 @@ if(hasProperty('target') && target == 'android') {
targetSdkVersion 25
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Rename the aar correctly
@@ -79,8 +79,8 @@ if(hasProperty('target') && target == 'android') {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
@@ -94,6 +94,10 @@ if(hasProperty('target') && target == 'android') {
}
}
test {
useJUnitPlatform()
}
ext {
swagger_annotations_version = "1.5.24"
jackson_version = "2.10.3"
@@ -102,8 +106,8 @@ ext {
jackson_threetenbp_version = "2.9.10"
feign_version = "10.11"
feign_form_version = "3.8.0"
junit_version = "4.13.1"
oltu_version = "1.0.1"
junit_version = "5.7.0"
scribejava_version = "8.0.0"
}
dependencies {
@@ -112,14 +116,22 @@ dependencies {
implementation "io.github.openfeign:feign-core:$feign_version"
implementation "io.github.openfeign:feign-jackson:$feign_version"
implementation "io.github.openfeign:feign-slf4j:$feign_version"
implementation "io.github.openfeign:feign-okhttp:$feign_version"
implementation "io.github.openfeign.form:feign-form:$feign_form_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version"
implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"
implementation "com.brsanthu:migbase64:2.2"
implementation "com.github.scribejava:scribejava-core:$scribejava_version"
implementation "com.brsanthu:migbase64:2.2"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2"
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation "commons-io:commons-io:2.8.0"
testImplementation "ch.qos.logback:logback-classic:1.2.3"
}

View File

@@ -10,19 +10,25 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.24" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"io.github.openfeign" % "feign-core" % "10.11" % "compile",
"io.github.openfeign" % "feign-jackson" % "10.11" % "compile",
"io.github.openfeign" % "feign-slf4j" % "10.11" % "compile",
"io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile",
"io.github.openfeign" % "feign-okhttp" % "10.11" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test",
"org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test",
"com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test",
"org.hamcrest" % "hamcrest" % "2.2" % "test",
"commons-io" % "commons-io" % "2.8.0" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)

View File

@@ -2151,10 +2151,12 @@ components:
properties:
breed:
type: string
type: object
Cat_allOf:
properties:
declawed:
type: boolean
type: object
BigCat_allOf:
properties:
kind:
@@ -2164,6 +2166,7 @@ components:
- leopards
- jaguars
type: string
type: object
securitySchemes:
petstore_auth:
flows:

View File

@@ -154,7 +154,7 @@
<version>3.1.1</version>
<configuration>
<doclint>none</doclint>
<source>1.7</source>
<source>1.8</source>
</configuration>
<executions>
<execution>
@@ -240,6 +240,11 @@
<artifactId>feign-form</artifactId>
<version>${feign-form-version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>${feign-version}</version>
</dependency>
<!-- JSON processing: jackson -->
<dependency>
@@ -262,15 +267,15 @@
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable-version}</version>
</dependency>
<dependency>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>${jackson-threetenbp-version}</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>${oltu-version}</version>
<groupId>com.github.joschi.jackson</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId>
<version>${jackson-threetenbp-version}</version>
</dependency>
<dependency>
<groupId>com.github.scribejava</groupId>
<artifactId>scribejava-core</artifactId>
<version>${scribejava-version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
@@ -281,27 +286,45 @@
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>3.6.0</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.7.1</version>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-annotations-version>1.5.24</swagger-annotations-version>
@@ -312,8 +335,8 @@
<jackson-databind-version>2.10.3</jackson-databind-version>
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>5.7.0</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<oltu-version>1.0.1</oltu-version>
<scribejava-version>8.0.0</scribejava-version>
</properties>
</project>

View File

@@ -2,11 +2,11 @@ package org.openapitools.client;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.threeten.bp.*;
import feign.okhttp.OkHttpClient;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -25,6 +25,8 @@ import org.openapitools.client.auth.OAuth.AccessTokenListener;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiClient {
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
public interface Api {}
protected ObjectMapper objectMapper;
@@ -36,6 +38,7 @@ public class ApiClient {
objectMapper = createObjectMapper();
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
feignBuilder = Feign.builder()
.client(new OkHttpClient())
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger());
@@ -44,6 +47,7 @@ public class ApiClient {
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
log.log(Level.FINE, "Creating authentication {0}", authName);
RequestInterceptor auth;
if ("api_key".equals(authName)) {
auth = new ApiKeyAuth("header", "api_key");
@@ -52,7 +56,7 @@ public class ApiClient {
} else if ("http_basic_test".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("petstore_auth".equals(authName)) {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
auth = buildOauthRequestInterceptor(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
@@ -78,34 +82,6 @@ public class ApiClient {
this.setApiKey(apiKey);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName
* @param username
* @param password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single password oauth2
* @param authName
* @param clientId
* @param secret
* @param username
* @param password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
public String getBasePath() {
return basePath;
}
@@ -150,10 +126,25 @@ public class ApiClient {
return objectMapper;
}
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
switch (flow) {
case password:
return new OauthPasswordGrant(tokenUrl, scopes);
case application:
return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes);
default:
throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented");
}
}
public ObjectMapper getObjectMapper(){
return objectMapper;
}
public void setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
/**
* Creates a feign client for given API interface.
*
@@ -200,19 +191,13 @@ public class ApiClient {
return contentTypes[0];
}
/**
* Helper method to configure the bearer token.
* @param bearerToken the bearer token.
*/
public void setBearerToken(String bearerToken) {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBearerAuth) {
((HttpBearerAuth) apiAuthorization).setBearerToken(bearerToken);
return;
}
}
throw new RuntimeException("No Bearer authentication configured!");
HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class);
apiAuthorization.setBearerToken(bearerToken);
}
/**
@@ -220,63 +205,38 @@ public class ApiClient {
* @param apiKey API key
*/
public void setApiKey(String apiKey) {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return ;
}
}
throw new RuntimeException("No API key authentication configured!");
ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class);
apiAuthorization.setApiKey(apiKey);
}
/**
* Helper method to configure the username/password for basic auth or password OAuth
* Helper method to configure the username/password for basic auth
* @param username Username
* @param password Password
*/
public void setCredentials(String username, String password) {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return;
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return;
}
}
throw new RuntimeException("No Basic authentication or OAuth configured!");
HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class);
apiAuthorization.setCredentials(username, password);
}
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
* Helper method to configure the client credentials for Oauth
* @param username Username
* @param password Password
*/
public TokenRequestBuilder getTokenEndPoint() {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
public void setClientCredentials(String clientId, String clientSecret) {
OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class);
authorization.configure(clientId, clientSecret);
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
* Helper method to configure the username/password for Oauth password grant
* @param username Username
* @param password Password
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
public void setOauthPassword(String username, String password, String clientId, String clientSecret) {
OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class);
apiAuthorization.configure(username, password, clientId, clientSecret);
}
/**
@@ -284,14 +244,9 @@ public class ApiClient {
* @param accessToken Access Token
* @param expiresIn Validity period in seconds
*/
public void setAccessToken(String accessToken, Long expiresIn) {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken, expiresIn);
return;
}
}
public void setAccessToken(String accessToken, Integer expiresIn) {
OAuth apiAuthorization = getAuthorization(OAuth.class);
apiAuthorization.setAccessToken(accessToken, expiresIn);
}
/**
@@ -301,19 +256,7 @@ public class ApiClient {
* @param redirectURI Redirect URI
*/
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return;
}
}
throw new RuntimeException("Not implemented");
}
/**
@@ -321,13 +264,8 @@ public class ApiClient {
* @param accessTokenListener Acesss token listener
*/
public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return;
}
}
OAuth apiAuthorization = getAuthorization(OAuth.class);
apiAuthorization.registerAccessTokenListener(accessTokenListener);
}
/**
@@ -352,4 +290,11 @@ public class ApiClient {
feignBuilder.requestInterceptor(authorization);
}
private <T extends RequestInterceptor> T getAuthorization(Class<T> type) {
return (T) apiAuthorizations.values()
.stream()
.filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass()))
.findFirst()
.orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!"));
}
}

View File

@@ -0,0 +1,47 @@
package org.openapitools.client.auth;
import com.github.scribejava.core.builder.api.DefaultApi20;
import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor;
import com.github.scribejava.core.extractors.TokenExtractor;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.oauth2.bearersignature.BearerSignature;
import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter;
import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication;
import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DefaultApi20Impl extends DefaultApi20 {
private final String accessTokenEndpoint;
private final String authorizationBaseUrl;
protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) {
this.authorizationBaseUrl = authorizationBaseUrl;
this.accessTokenEndpoint = accessTokenEndpoint;
}
@Override
public String getAccessTokenEndpoint() {
return accessTokenEndpoint;
}
@Override
protected String getAuthorizationBaseUrl() {
return authorizationBaseUrl;
}
@Override
public BearerSignature getBearerSignature() {
return BearerSignatureURIQueryParameter.instance();
}
@Override
public ClientAuthentication getClientAuthentication() {
return RequestBodyAuthenticationScheme.instance();
}
@Override
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor() {
return OAuth2AccessTokenJsonExtractor.instance();
}
}

View File

@@ -1,198 +1,81 @@
package org.openapitools.client.auth;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.oltu.oauth2.client.HttpClient;
import org.apache.oltu.oauth2.client.OAuthClient;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
import org.apache.oltu.oauth2.client.response.OAuthClientResponse;
import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory;
import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse;
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.message.types.GrantType;
import org.apache.oltu.oauth2.common.token.BasicOAuthToken;
import feign.Client;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.oauth.OAuth20Service;
import feign.Request.HttpMethod;
import feign.Request.Options;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import feign.Response;
import feign.RetryableException;
import feign.Util;
import org.openapitools.client.StringUtil;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public abstract class OAuth implements RequestInterceptor {
public class OAuth implements RequestInterceptor {
static final int MILLIS_PER_SECOND = 1000;
static final int MILLIS_PER_SECOND = 1000;
public interface AccessTokenListener {
void notify(OAuth2AccessToken token);
}
public interface AccessTokenListener {
void notify(BasicOAuthToken token);
private volatile String accessToken;
private Long expirationTimeMillis;
private AccessTokenListener accessTokenListener;
protected OAuth20Service service;
protected String scopes;
protected String authorizationUrl;
protected String tokenUrl;
public OAuth(String authorizationUrl, String tokenUrl, String scopes) {
this.scopes = scopes;
this.authorizationUrl = authorizationUrl;
this.tokenUrl = tokenUrl;
}
@Override
public void apply(RequestTemplate template) {
// If the request already have an authorization (eg. Basic auth), do nothing
if (template.headers().containsKey("Authorization")) {
return;
}
private volatile String accessToken;
private Long expirationTimeMillis;
private OAuthClient oauthClient;
private TokenRequestBuilder tokenRequestBuilder;
private AuthenticationRequestBuilder authenticationRequestBuilder;
private AccessTokenListener accessTokenListener;
public OAuth(Client client, TokenRequestBuilder requestBuilder) {
this.oauthClient = new OAuthClient(new OAuthFeignClient(client));
this.tokenRequestBuilder = requestBuilder;
// If first time, get the token
if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) {
updateAccessToken(template);
}
public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes));
switch(flow) {
case accessCode:
case implicit:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
case password:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
case application:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:
break;
}
authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl);
if (getAccessToken() != null) {
template.header("Authorization", "Bearer " + getAccessToken());
}
}
public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes);
private synchronized void updateAccessToken(RequestTemplate template) {
OAuth2AccessToken accessTokenResponse;
try {
accessTokenResponse = getOAuth2AccessToken();
} catch (Exception e) {
throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request());
}
@Override
public void apply(RequestTemplate template) {
// If the request already have an authorization (eg. Basic auth), do nothing
if (template.headers().containsKey("Authorization")) {
return;
}
// If first time, get the token
if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) {
updateAccessToken(template);
}
if (getAccessToken() != null) {
template.header("Authorization", "Bearer " + getAccessToken());
}
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());
if (accessTokenListener != null) {
accessTokenListener.notify(accessTokenResponse);
}
}
}
public synchronized void updateAccessToken(RequestTemplate template) {
OAuthJSONAccessTokenResponse accessTokenResponse;
try {
accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage());
} catch (Exception e) {
throw new RetryableException(0, e.getMessage(), HttpMethod.POST, e, null, template.request());
}
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());
if (accessTokenListener != null) {
accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken());
}
}
}
abstract OAuth2AccessToken getOAuth2AccessToken();
public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
this.accessTokenListener = accessTokenListener;
}
abstract OAuthFlow getFlow();
public synchronized String getAccessToken() {
return accessToken;
}
public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
this.accessTokenListener = accessTokenListener;
}
public synchronized void setAccessToken(String accessToken, Long expiresIn) {
this.accessToken = accessToken;
this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND;
}
public synchronized String getAccessToken() {
return accessToken;
}
public TokenRequestBuilder getTokenRequestBuilder() {
return tokenRequestBuilder;
}
public synchronized void setAccessToken(String accessToken, Integer expiresIn) {
this.accessToken = accessToken;
this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND;
}
public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) {
this.tokenRequestBuilder = tokenRequestBuilder;
}
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
return authenticationRequestBuilder;
}
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
this.authenticationRequestBuilder = authenticationRequestBuilder;
}
public OAuthClient getOauthClient() {
return oauthClient;
}
public void setOauthClient(OAuthClient oauthClient) {
this.oauthClient = oauthClient;
}
public void setOauthClient(Client client) {
this.oauthClient = new OAuthClient( new OAuthFeignClient(client));
}
public static class OAuthFeignClient implements HttpClient {
private Client client;
public OAuthFeignClient() {
this.client = new Client.Default(null, null);
}
public OAuthFeignClient(Client client) {
this.client = client;
}
public <T extends OAuthClientResponse> T execute(OAuthClientRequest request, Map<String, String> headers,
String requestMethod, Class<T> responseClass)
throws OAuthSystemException, OAuthProblemException {
RequestTemplate req = new RequestTemplate()
.append(request.getLocationUri())
.method(requestMethod)
.body(request.getBody());
for (Entry<String, String> entry : headers.entrySet()) {
req.header(entry.getKey(), entry.getValue());
}
Response feignResponse;
String body = "";
try {
feignResponse = client.execute(req.request(), new Options());
body = Util.toString(feignResponse.body().asReader());
} catch (IOException e) {
throw new OAuthSystemException(e);
}
String contentType = null;
Collection<String> contentTypeHeader = feignResponse.headers().get("Content-Type");
if(contentTypeHeader != null) {
contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";");
}
return OAuthClientResponseFactory.createCustomResponse(
body,
contentType,
feignResponse.status(),
responseClass
);
}
public void shutdown() {
// Nothing to do here
}
}
}
}

View File

@@ -13,6 +13,10 @@
package org.openapitools.client.auth;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public enum OAuthFlow {
accessCode, implicit, password, application
accessCode, //called authorizationCode in OpenAPI 3.0
implicit,
password,
application //called clientCredentials in OpenAPI 3.0
}

View File

@@ -0,0 +1,39 @@
package org.openapitools.client.auth;
import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.OAuth2AccessToken;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class OauthClientCredentialsGrant extends OAuth {
public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) {
super(authorizationUrl, tokenUrl, scopes);
}
@Override
protected OAuth2AccessToken getOAuth2AccessToken() {
try {
return service.getAccessTokenClientCredentialsGrant(scopes);
} catch (Exception e) {
throw new RuntimeException("Failed to get oauth token", e);
}
}
@Override
protected OAuthFlow getFlow() {
return OAuthFlow.application;
}
/**
* Configures the client credentials flow
*
* @param clientId
* @param clientSecret
*/
public void configure(String clientId, String clientSecret) {
service = new ServiceBuilder(clientId)
.apiSecret(clientSecret)
.defaultScope(scopes)
.build(new DefaultApi20Impl(authorizationUrl, tokenUrl));
}
}

View File

@@ -0,0 +1,48 @@
package org.openapitools.client.auth;
import com.github.scribejava.core.builder.ServiceBuilder;
import com.github.scribejava.core.model.OAuth2AccessToken;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class OauthPasswordGrant extends OAuth {
private String username;
private String password;
public OauthPasswordGrant(String tokenUrl, String scopes) {
super(null, tokenUrl, scopes);
}
@Override
protected OAuth2AccessToken getOAuth2AccessToken() {
try {
return service.getAccessTokenPasswordGrant(username, password);
} catch (Exception e) {
throw new RuntimeException("Failed to get oauth token", e);
}
}
@Override
protected OAuthFlow getFlow() {
return OAuthFlow.password;
}
/**
* Configures Oauth password grant flow
* Note: this flow is deprecated.
*
* @param username
* @param password
* @param clientId
* @param clientSecret
*/
public void configure(String username, String password, String clientId, String clientSecret) {
this.username = username;
this.password = password;
//TODO the clientId and secret are optional according with the RFC
service = new ServiceBuilder(clientId)
.apiSecret(clientSecret)
.defaultScope(scopes)
.build(new DefaultApi20Impl(authorizationUrl, tokenUrl));
}
}

View File

@@ -82,7 +82,6 @@ public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -83,7 +83,6 @@ public class AdditionalPropertiesArray extends HashMap<String, List> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -82,7 +82,6 @@ public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -447,7 +447,6 @@ public class AdditionalPropertiesClass {
return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -82,7 +82,6 @@ public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -83,7 +83,6 @@ public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -82,7 +82,6 @@ public class AdditionalPropertiesObject extends HashMap<String, Map> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -82,7 +82,6 @@ public class AdditionalPropertiesString extends HashMap<String, String> {
return Objects.hash(name, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -120,7 +120,6 @@ public class Animal {
return Objects.hash(className, color);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -90,7 +90,6 @@ public class ArrayOfArrayOfNumberOnly {
return Objects.hash(arrayArrayNumber);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -90,7 +90,6 @@ public class ArrayOfNumberOnly {
return Objects.hash(arrayNumber);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -166,7 +166,6 @@ public class ArrayTest {
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -125,7 +125,6 @@ public class BigCat extends Cat {
return Objects.hash(kind, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -118,7 +118,6 @@ public class BigCatAllOf {
return Objects.hash(kind);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -229,7 +229,6 @@ public class Capitalization {
return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -90,7 +90,6 @@ public class Cat extends Animal {
return Objects.hash(declawed, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -79,7 +79,6 @@ public class CatAllOf {
return Objects.hash(declawed);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -108,7 +108,6 @@ public class Category {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -80,7 +80,6 @@ public class ClassModel {
return Objects.hash(propertyClass);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -79,7 +79,6 @@ public class Client {
return Objects.hash(client);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -86,7 +86,6 @@ public class Dog extends Animal {
return Objects.hash(breed, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -79,7 +79,6 @@ public class DogAllOf {
return Objects.hash(breed);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -189,7 +189,6 @@ public class EnumArrays {
return Objects.hash(justSymbol, arrayEnum);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -343,7 +343,6 @@ public class EnumTest {
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -119,7 +119,6 @@ public class FileSchemaTestClass {
return Objects.hash(file, files);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -480,7 +480,6 @@ public class FormatTest {
return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -91,7 +91,6 @@ public class HasOnlyReadOnly {
return Objects.hash(bar, foo);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -239,7 +239,6 @@ public class MapTest {
return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -153,7 +153,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
return Objects.hash(uuid, dateTime, map);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -110,7 +110,6 @@ public class Model200Response {
return Objects.hash(name, propertyClass);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -139,7 +139,6 @@ public class ModelApiResponse {
return Objects.hash(code, type, message);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -80,7 +80,6 @@ public class ModelReturn {
return Objects.hash(_return);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -151,7 +151,6 @@ public class Name {
return Objects.hash(name, snakeCase, property, _123number);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -80,7 +80,6 @@ public class NumberOnly {
return Objects.hash(justNumber);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -267,7 +267,6 @@ public class Order {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -140,7 +140,6 @@ public class OuterComposite {
return Objects.hash(myNumber, myString, myBoolean);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -283,7 +283,6 @@ public class Pet {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -100,7 +100,6 @@ public class ReadOnlyFirst {
return Objects.hash(bar, baz);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -79,7 +79,6 @@ public class SpecialModelName {
return Objects.hash($specialPropertyName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -109,7 +109,6 @@ public class Tag {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -202,7 +202,6 @@ public class TypeHolderDefault {
return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -231,7 +231,6 @@ public class TypeHolderExample {
return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -289,7 +289,6 @@ public class User {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -994,7 +994,6 @@ public class XmlItem {
return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View File

@@ -1,24 +1,19 @@
package org.openapitools.client.api;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Client;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* API tests for AnotherFakeApi
*/
public class AnotherFakeApiTest {
class AnotherFakeApiTest {
private AnotherFakeApi api;
@Before
public void setup() {
@BeforeEach
void setup() {
api = new ApiClient().buildClient(AnotherFakeApi.class);
}
@@ -29,7 +24,7 @@ public class AnotherFakeApiTest {
* To test special tags and operation ID starting with number
*/
@Test
public void call123testSpecialTagsTest() {
void call123testSpecialTagsTest() {
Client body = null;
// Client response = api.call123testSpecialTags(body);

View File

@@ -1,342 +1,321 @@
package org.openapitools.client.api;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.common.Slf4jNotifier;
import feign.FeignException;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.openapitools.client.ApiClient;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import org.junit.Before;
import org.junit.Test;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import java.util.ArrayList;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* API tests for FakeApi
*/
public class FakeApiTest {
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
private FakeApi api;
class FakeApiTest {
@Before
public void setup() {
api = new ApiClient().buildClient(FakeApi.class);
}
private static WireMockServer wm = new WireMockServer(options().dynamicPort().notifier(new Slf4jNotifier(true)));
/**
* creates an XmlItem
*
* this route creates an XmlItem
*/
@Test
public void createXmlItemTest() {
XmlItem xmlItem = null;
// api.createXmlItem(xmlItem);
private FakeApi api;
// TODO: test validations
}
@BeforeAll
static void startWireMock() {
wm.start();
}
/**
*
*
* Test serialization of outer boolean types
*/
@Test
public void fakeOuterBooleanSerializeTest() {
Boolean body = null;
// Boolean response = api.fakeOuterBooleanSerialize(body);
@AfterAll
static void stopWireMock() {
wm.shutdown();
}
// TODO: test validations
}
@BeforeEach
void setUp() {
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(wm.baseUrl());
api = apiClient.buildClient(FakeApi.class);
}
/**
*
*
* Test serialization of object with outer number type
*/
@Test
public void fakeOuterCompositeSerializeTest() {
OuterComposite body = null;
// OuterComposite response = api.fakeOuterCompositeSerialize(body);
@Test
void createXmlItem() {
wm.stubFor(post(urlEqualTo("/fake/create_xml_item"))
.withHeader("Content-Type", equalTo("application/xml"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok()));
// TODO: test validations
}
XmlItem xmlItem = new XmlItem();
api.createXmlItem(xmlItem);
}
/**
*
*
* Test serialization of outer number types
*/
@Test
public void fakeOuterNumberSerializeTest() {
BigDecimal body = null;
// BigDecimal response = api.fakeOuterNumberSerialize(body);
@ParameterizedTest
@ValueSource(strings = {"true", "false"})
void fakeOuterBooleanSerialize(String returnBoolean) {
wm.stubFor(post(urlEqualTo("/fake/outer/boolean"))
.withHeader("Content-Type", equalTo("*/*"))
.withHeader("Accept", equalTo("*/*"))
.willReturn(ok(returnBoolean)));
// TODO: test validations
}
boolean expectedBoolean = Boolean.parseBoolean(returnBoolean);
Boolean aBoolean = api.fakeOuterBooleanSerialize(expectedBoolean);
/**
*
*
* Test serialization of outer string types
*/
@Test
public void fakeOuterStringSerializeTest() {
String body = null;
// String response = api.fakeOuterStringSerialize(body);
assertThat(aBoolean, is(expectedBoolean));
}
// TODO: test validations
}
@Test
void fakeOuterCompositeSerialize() {
String body = "{\n" +
" \"my_number\": 123.45,\n" +
" \"my_string\":\"Hello\",\n" +
" \"my_boolean\": true\n" +
"}";
wm.stubFor(post(urlEqualTo("/fake/outer/composite"))
.withHeader("Content-Type", equalTo("*/*"))
.withHeader("Accept", equalTo("*/*"))
.withRequestBody(equalToJson(body, true, false))
.willReturn(ok(body)));
/**
*
*
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*/
@Test
public void testBodyWithFileSchemaTest() {
FileSchemaTestClass body = null;
// api.testBodyWithFileSchema(body);
OuterComposite outerComposite = new OuterComposite();
outerComposite.setMyBoolean(Boolean.TRUE);
outerComposite.setMyNumber(BigDecimal.valueOf(123.45));
outerComposite.setMyString("Hello");
// TODO: test validations
}
OuterComposite result = api.fakeOuterCompositeSerialize(outerComposite);
/**
*
*
*
*/
@Test
public void testBodyWithQueryParamsTest() {
String query = null;
User body = null;
// api.testBodyWithQueryParams(query, body);
assertThat(result, is(outerComposite));
}
// TODO: test validations
}
@Test
void fakeOuterNumberSerialize() {
String body = "123.45";
wm.stubFor(post(urlEqualTo("/fake/outer/number"))
.withHeader("Content-Type", equalTo("*/*"))
.withHeader("Accept", equalTo("*/*"))
.withRequestBody(equalTo(body))
.willReturn(ok(body)));
/**
*
*
*
*
* This tests the overload of the method that uses a Map for query parameters instead of
* listing them out individually.
*/
@Test
public void testBodyWithQueryParamsTestQueryMap() {
User body = null;
FakeApi.TestBodyWithQueryParamsQueryParams queryParams = new FakeApi.TestBodyWithQueryParamsQueryParams()
.query(null);
// api.testBodyWithQueryParams(body, queryParams);
BigDecimal result = api.fakeOuterNumberSerialize(BigDecimal.valueOf(123.45));
// TODO: test validations
}
/**
* To test \&quot;client\&quot; model
*
* To test \&quot;client\&quot; model
*/
@Test
public void testClientModelTest() {
Client body = null;
// Client response = api.testClientModel(body);
assertThat(result, is(result));
}
// TODO: test validations
}
@Test
void fakeOuterStringSerialize() {
String body = "Hello world";
wm.stubFor(post(urlEqualTo("/fake/outer/string"))
.withHeader("Content-Type", equalTo("*/*"))
.withHeader("Accept", equalTo("*/*"))
.withRequestBody(equalTo("\"" + body + "\""))
.willReturn(ok("\"" + body + "\"")));
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*/
@Test
public void testEndpointParametersTest() {
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);
String result = api.fakeOuterStringSerialize(body);
// TODO: test validations
}
assertThat(result, is(body));
}
/**
* To test enum parameters
*
* To test enum parameters
*/
@Test
public void testEnumParametersTest() {
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);
@Test
void testBodyWithFileSchema() throws IOException {
//TODO
}
// TODO: test validations
}
@Test
void testBodyWithQueryParams() {
String body = "{\n" +
" \"id\":123456,\n" +
" \"username\":null,\n" +
" \"firstName\":\"Bruce\",\n" +
" \"lastName\":\"Wayne\",\n" +
" \"email\":\"mail@email.com\",\n" +
" \"password\":\"password\",\n" +
" \"phone\":\"+123 3313131\",\n" +
" \"userStatus\":1\n" +
"}";
/**
* To test enum parameters
*
* To test enum parameters
*
* This tests the overload of the method that uses a Map for query parameters instead of
* listing them out individually.
*/
@Test
public void testEnumParametersTestQueryMap() {
List<String> enumHeaderStringArray = null;
String enumHeaderString = null;
List<String> enumFormStringArray = null;
String enumFormString = null;
FakeApi.TestEnumParametersQueryParams queryParams = new FakeApi.TestEnumParametersQueryParams()
.enumQueryStringArray(null)
.enumQueryString(null)
.enumQueryInteger(null)
.enumQueryDouble(null);
// api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumFormStringArray, enumFormString, queryParams);
wm.stubFor(put(urlEqualTo("/fake/body-with-query-params?query=tags"))
.withHeader("Content-Type", equalTo("application/json"))
.withHeader("Accept", equalTo("application/json"))
.withRequestBody(equalToJson(body))
.willReturn(ok()));
// TODO: test validations
}
/**
* Fake endpoint to test group parameters (optional)
*
* Fake endpoint to test group parameters (optional)
*/
@Test
public void testGroupParametersTest() {
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);
User user = new User();
user.setEmail("mail@email.com");
user.setFirstName("Bruce");
user.setLastName("Wayne");
user.setId(123456L);
user.setUserStatus(1);
user.setPassword("password");
user.setPhone("+123 3313131");
// TODO: test validations
}
api.testBodyWithQueryParams("tags", user);
}
/**
* Fake endpoint to test group parameters (optional)
*
* Fake endpoint to test group parameters (optional)
*
* This tests the overload of the method that uses a Map for query parameters instead of
* listing them out individually.
*/
@Test
public void testGroupParametersTestQueryMap() {
Boolean requiredBooleanGroup = null;
Boolean booleanGroup = null;
FakeApi.TestGroupParametersQueryParams queryParams = new FakeApi.TestGroupParametersQueryParams()
.requiredStringGroup(null)
.requiredInt64Group(null)
.stringGroup(null)
.int64Group(null);
// api.testGroupParameters(requiredBooleanGroup, booleanGroup, queryParams);
@Test
void testBodyWithQueryParamsMap() {
String body = "{\n" +
" \"id\":123456,\n" +
" \"username\":null,\n" +
" \"firstName\":\"Bruce\",\n" +
" \"lastName\":\"Wayne\",\n" +
" \"email\":\"mail@email.com\",\n" +
" \"password\":\"password\",\n" +
" \"phone\":\"+123 3313131\",\n" +
" \"userStatus\":1\n" +
"}";
// TODO: test validations
}
/**
* test inline additionalProperties
*
*
*/
@Test
public void testInlineAdditionalPropertiesTest() {
Map<String, String> param = null;
// api.testInlineAdditionalProperties(param);
wm.stubFor(put(urlEqualTo("/fake/body-with-query-params?query=value1"))
.withHeader("Content-Type", equalTo("application/json"))
.withHeader("Accept", equalTo("application/json"))
.withRequestBody(equalToJson(body))
.willReturn(ok()));
// TODO: test validations
}
User user = new User();
user.setEmail("mail@email.com");
user.setFirstName("Bruce");
user.setLastName("Wayne");
user.setId(123456L);
user.setUserStatus(1);
user.setPassword("password");
user.setPhone("+123 3313131");
/**
* test json serialization of form data
*
*
*/
@Test
public void testJsonFormDataTest() {
String param = null;
String param2 = null;
// api.testJsonFormData(param, param2);
FakeApi.TestBodyWithQueryParamsQueryParams queryParams = new FakeApi.TestBodyWithQueryParamsQueryParams();
queryParams.query("value1");
// TODO: test validations
}
api.testBodyWithQueryParams(user, queryParams);
}
/**
*
*
* To test the collection format in query parameters
*/
@Test
public void testQueryParameterCollectionFormatTest() {
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);
@Test
void testClientModel() {
String body = "{\n" +
" \"client\":\"Mr Wayne\"\n" +
"}";
// TODO: test validations
}
wm.stubFor(patch(urlEqualTo("/fake"))
.withHeader("Content-Type", equalTo("application/json"))
.withHeader("Accept", equalTo("application/json"))
.withRequestBody(equalToJson(body))
.willReturn(ok(body)));
/**
*
*
* To test the collection format in query parameters
*
* This tests the overload of the method that uses a Map for query parameters instead of
* listing them out individually.
*/
@Test
public void testQueryParameterCollectionFormatTestQueryMap() {
FakeApi.TestQueryParameterCollectionFormatQueryParams queryParams = new FakeApi.TestQueryParameterCollectionFormatQueryParams()
.pipe(null)
.ioutil(null)
.http(null)
.url(null)
.context(null);
// api.testQueryParameterCollectionFormat(queryParams);
Client client = new Client();
client.setClient("Mr Wayne");
// TODO: test validations
}
}
Client result = api.testClientModel(client);
assertThat(result.getClient(), is("Mr Wayne"));
}
@Test
void testEndpointParameters() throws IOException {
wm.stubFor(post(urlEqualTo("/fake"))
.withHeader("Content-Type", containing("application/x-www-form-urlencoded"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok()));
//TODO Cannot serialize bytearray to x-www-form-urlencoded, must use multipart
api.testEndpointParameters(BigDecimal.ONE, 1.0, "abc", null, 123,
1234, 123L, 1.0f, "string", File.createTempFile("testEndpointParameters", "tmp"), LocalDate.now(), OffsetDateTime.now(),
"password", "callback");
}
@Test
void testEnumParameters() {
//TODO GET method does not allow request body
}
@Test
void testGroupParameters() {
wm.stubFor(delete(urlEqualTo("/fake?required_string_group=123&required_int64_group=123&string_group=123&int64_group=123"))
.withHeader("Accept", equalTo("application/json"))
.withHeader("required_boolean_group", equalTo("true"))
.withHeader("boolean_group", equalTo("true"))
.willReturn(ok()));
api.testGroupParameters(123, true, 123L, 123, true, 123L);
}
@Test
void testInlineAdditionalProperties() {
wm.stubFor(post(urlEqualTo("/fake/inline-additionalProperties"))
.withHeader("Content-Type", equalTo("application/json"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok()));
api.testInlineAdditionalProperties(new HashMap<>());
}
@Test
void testQueryParameterCollectionFormat() {
wm.stubFor(put(urlEqualTo("/fake/test-query-paramters?pipe=pipe1&pipe=pipe2&ioutil=io&http=http&url=url&context=context"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok()));
api.testQueryParameterCollectionFormat(Arrays.asList("pipe1", "pipe2"), Arrays.asList("io"), Arrays.asList("http"), Arrays.asList("url"), Arrays.asList("context"));
}
@Test
void testQueryParameterCollectionFormatQueryParams() {
wm.stubFor(put(urlEqualTo("/fake/test-query-paramters?ioutil=io&context=context&http=http&pipe=pipe1&pipe=pipe2&url=url"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok()));
HashMap<String, Object> params = new HashMap<>();
params.put("context", Arrays.asList("context"));
params.put("pipe", Arrays.asList("pipe1", "pipe2"));
params.put("ioutil", Arrays.asList("io"));
params.put("http", Arrays.asList("http"));
params.put("url", Arrays.asList("url"));
api.testQueryParameterCollectionFormat(params);
}
@Test
void test404() {
wm.stubFor(post(urlEqualTo("/fake/create_xml_item"))
.withHeader("Content-Type", equalTo("application/xml"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(notFound()));
XmlItem xmlItem = new XmlItem();
assertThrows(FeignException.NotFound.class, () -> api.createXmlItem(xmlItem));
}
@Test
void test500() {
wm.stubFor(post(urlEqualTo("/fake/create_xml_item"))
.withHeader("Content-Type", equalTo("application/xml"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(serverError()));
XmlItem xmlItem = new XmlItem();
assertThrows(FeignException.InternalServerError.class, () -> api.createXmlItem(xmlItem));
}
@Test
void test400() {
wm.stubFor(post(urlEqualTo("/fake/create_xml_item"))
.withHeader("Content-Type", equalTo("application/xml"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(badRequest()));
XmlItem xmlItem = new XmlItem();
assertThrows(FeignException.BadRequest.class, () -> api.createXmlItem(xmlItem));
}
}

View File

@@ -1,40 +1,66 @@
package org.openapitools.client.api;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.common.Slf4jNotifier;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Client;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* API tests for FakeClassnameTags123Api
*/
public class FakeClassnameTags123ApiTest {
class FakeClassnameTags123ApiTest {
private FakeClassnameTags123Api api;
private static WireMockServer wm = new WireMockServer(options().dynamicPort().notifier(new Slf4jNotifier(true)));
@Before
public void setup() {
api = new ApiClient().buildClient(FakeClassnameTags123Api.class);
}
private FakeClassnameTags123Api api;
/**
* To test class name in snake case
*
* To test class name in snake case
*/
@Test
public void testClassnameTest() {
Client body = null;
// Client response = api.testClassname(body);
@BeforeAll
static void startWireMock() {
wm.start();
}
@AfterAll
static void stopWireMock() {
wm.shutdown();
}
@BeforeEach
void setUp() {
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(wm.baseUrl());
api = apiClient.buildClient(FakeClassnameTags123Api.class);
}
/**
* To test class name in snake case
* <p>
* To test class name in snake case
*/
@Test
void testClassnameTest() {
String responseBody = "{\n" +
" \"client\":\"Bruce\"\n" +
"}";
wm.stubFor(patch(urlEqualTo("/fake_classname_test"))
.withHeader("Content-Type", equalTo("application/json"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok(responseBody)));
Client client = new Client();
client.setClient("Bruce");
Client response = api.testClassname(client);
assertThat(response, is(client));
}
// TODO: test validations
}
}

View File

@@ -1,194 +1,210 @@
package org.openapitools.client.api;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.matching.MultipartValuePatternBuilder;
import com.google.common.collect.Sets;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiClient;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* API tests for PetApi
* API tests for PetAp
*/
public class PetApiTest {
class PetApiTest {
private PetApi api;
private static PetApi api;
@Before
public void setup() {
api = new ApiClient().buildClient(PetApi.class);
}
private static WireMockServer wm = new WireMockServer(options().dynamicPort());
private static String petJson;
private static String petListJson;
/**
* Add a new pet to the store
*
*
*/
@Test
public void addPetTest() {
Pet body = null;
// api.addPet(body);
private ObjectMapper objectMapper = new ObjectMapper();
// TODO: test validations
}
@BeforeAll
static void setup() throws IOException {
wm.start();
/**
* Deletes a pet
*
*
*/
@Test
public void deletePetTest() {
Long petId = null;
String apiKey = null;
// api.deletePet(petId, apiKey);
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(wm.baseUrl());
api = apiClient.buildClient(PetApi.class);
// TODO: test validations
}
petJson = IOUtils.toString(PetApiTest.class.getResourceAsStream("/pet.json"), "UTF-8");
petListJson = IOUtils.toString(PetApiTest.class.getResourceAsStream("/pet_list.json"), "UTF-8");
}
/**
* Finds Pets by status
*
* Multiple status values can be provided with comma separated strings
*/
@Test
public void findPetsByStatusTest() {
List<String> status = null;
// List<Pet> response = api.findPetsByStatus(status);
@AfterAll
static void shutdown() {
wm.shutdown();
}
// TODO: test validations
}
@Test
void addPet() throws JsonProcessingException {
wm.stubFor(post(urlEqualTo("/pet"))
.willReturn(aResponse().withBody(petJson)));
/**
* Finds Pets by status
*
* Multiple status values can be provided with comma separated strings
*
* This tests the overload of the method that uses a Map for query parameters instead of
* listing them out individually.
*/
@Test
public void findPetsByStatusTestQueryMap() {
PetApi.FindPetsByStatusQueryParams queryParams = new PetApi.FindPetsByStatusQueryParams()
.status(null);
// List<Pet> response = api.findPetsByStatus(queryParams);
Pet pet = objectMapper.readValue(petJson, Pet.class);
// TODO: test validations
}
/**
* Finds Pets by tags
*
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*/
@Test
public void findPetsByTagsTest() {
Set<String> tags = null;
// Set<Pet> response = api.findPetsByTags(tags);
api.addPet(pet);
// TODO: test validations
}
wm.verify(postRequestedFor(urlEqualTo("/pet"))
.withHeader("Content-Type", equalTo("application/json"))
.withHeader("Accept", equalTo("application/json"))
.withRequestBody(equalToJson(petJson)));
}
/**
* Finds Pets by tags
*
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* This tests the overload of the method that uses a Map for query parameters instead of
* listing them out individually.
*/
@Test
public void findPetsByTagsTestQueryMap() {
PetApi.FindPetsByTagsQueryParams queryParams = new PetApi.FindPetsByTagsQueryParams()
.tags(null);
// Set<Pet> response = api.findPetsByTags(queryParams);
@Test
void deletedPet() {
wm.stubFor(delete(urlEqualTo("/pet/85"))
.willReturn(aResponse()));
// TODO: test validations
}
/**
* Find pet by ID
*
* Returns a single pet
*/
@Test
public void getPetByIdTest() {
Long petId = null;
// Pet response = api.getPetById(petId);
api.deletePet(85L, "API_KEY");
// TODO: test validations
}
wm.verify(deleteRequestedFor(urlEqualTo("/pet/85"))
.withHeader("api_key", equalTo("API_KEY"))
.withHeader("Accept", equalTo("application/json")));
}
/**
* Update an existing pet
*
*
*/
@Test
public void updatePetTest() {
Pet body = null;
// api.updatePet(body);
@Test
void findPetsByStatus() {
wm.stubFor(get(urlEqualTo("/pet/findByStatus?status=available&status=sold"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(petListJson)));
// TODO: test validations
}
List<Pet> petList = api.findPetsByStatus(Arrays.asList("available", "sold"));
assertThat(petList.size(), is(2));
/**
* Updates a pet in the store with form data
*
*
*/
@Test
public void updatePetWithFormTest() {
Long petId = null;
String name = null;
String status = null;
// api.updatePetWithForm(petId, name, status);
validatePet1(petList.get(0));
validatePet2(petList.get(1));
}
// TODO: test validations
}
@Test
void findPetsByStatusQueryMap() {
wm.stubFor(get(urlEqualTo("/pet/findByStatus?status=available,sold"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(petListJson)));
/**
* uploads an image
*
*
*/
@Test
public void uploadFileTest() {
Long petId = null;
String additionalMetadata = null;
File file = null;
// ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
PetApi.FindPetsByStatusQueryParams findPetsByStatusQueryParams = new PetApi.FindPetsByStatusQueryParams();
findPetsByStatusQueryParams.status(Arrays.asList("available", "sold"));
// TODO: test validations
}
List<Pet> petList = api.findPetsByStatus(findPetsByStatusQueryParams);
assertThat(petList.size(), is(2));
/**
* uploads an image (required)
*
*
*/
@Test
public void uploadFileWithRequiredFileTest() {
Long petId = null;
File requiredFile = null;
String additionalMetadata = null;
// ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
validatePet1(petList.get(0));
validatePet2(petList.get(1));
}
// TODO: test validations
}
@Test
void findPetsByTags() {
wm.stubFor(get(urlEqualTo("/pet/findByTags?tags=tag1&tags=tag2"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(petListJson)));
Set<Pet> petList = api.findPetsByTags(Sets.newHashSet("tag1", "tag2"));
assertThat(petList.size(), is(2));
}
@Test
void getPetById() {
wm.stubFor(get(urlEqualTo("/pet/85"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(petJson)));
Pet pet = api.getPetById(85L);
validatePet1(pet);
}
@Test
void updatePet() throws JsonProcessingException {
wm.stubFor(put(urlEqualTo("/pet"))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(petJson)));
Pet pet = objectMapper.readValue(petJson, Pet.class);
api.updatePet(pet);
wm.verify(putRequestedFor(urlEqualTo("/pet"))
.withHeader("Accept", equalTo("application/json"))
.withHeader("Content-Type", equalTo("application/json"))
.withRequestBody(equalToJson(petJson)));
}
@Test
void updatePetWithForm() {
wm.stubFor(post(anyUrl()).willReturn(aResponse()));
api.updatePetWithForm(85L, "Rex", "sold");
wm.verify(postRequestedFor(urlEqualTo("/pet/85"))
.withHeader("Accept", equalTo("application/json"))
.withHeader("Content-Type", containing("application/x-www-form-urlencoded"))
.withRequestBody(containing("name=Rex"))
.withRequestBody(containing("status=sold")));
}
@Test
void uploadFile() throws IOException {
wm.stubFor(post("/pet/85/uploadImage").willReturn(aResponse()));
File file = File.createTempFile("test", ".tmp");
IOUtils.write("ABCD".getBytes(), new FileOutputStream(file));
api.uploadFile(85L, "metadata", file);
wm.verify(postRequestedFor(urlEqualTo("/pet/85/uploadImage"))
.withHeader("Content-Type", containing("multipart/form-data"))
.withHeader("Accept", containing("application/json"))
.withRequestBodyPart(new MultipartValuePatternBuilder()
.withName("additionalMetadata").build())
.withRequestBodyPart(new MultipartValuePatternBuilder()
.withName("file").withBody(binaryEqualTo("ABCD".getBytes())).build())
);
}
private void validatePet1(Pet pet) {
assertThat(pet.getId(), is(85L));
assertThat(pet.getCategory().getName(), is("Dogs"));
assertThat(pet.getCategory().getId(), is(1L));
assertThat(pet.getName(), is("LvRcat"));
assertThat(pet.getPhotoUrls().size(), is(1));
assertThat(pet.getPhotoUrls().stream().findAny().get(), is("string"));
assertThat(pet.getTags().size(), is(1));
assertThat(pet.getTags().get(0).getId(), is(10L));
assertThat(pet.getTags().get(0).getName(), is("tag"));
assertThat(pet.getStatus(), is(Pet.StatusEnum.AVAILABLE));
}
private void validatePet2(Pet pet) {
assertThat(pet.getId(), is(42L));
assertThat(pet.getCategory().getName(), is("Dogs"));
assertThat(pet.getCategory().getId(), is(1L));
assertThat(pet.getName(), is("Louise"));
assertThat(pet.getPhotoUrls().size(), is(1));
assertThat(pet.getPhotoUrls().stream().findAny().get(), is("photo"));
assertThat(pet.getTags().size(), is(1));
assertThat(pet.getTags().get(0).getId(), is(0L));
assertThat(pet.getTags().get(0).getName(), is("obedient"));
assertThat(pet.getStatus(), is(Pet.StatusEnum.SOLD));
}
}

View File

@@ -1,81 +1,153 @@
package org.openapitools.client.api;
import com.github.tomakehurst.wiremock.WireMockServer;
import feign.FeignException;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Order;
import org.junit.Before;
import org.junit.Test;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneOffset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* API tests for StoreApi
*/
public class StoreApiTest {
private StoreApi api;
private static StoreApi api;
@Before
public void setup() {
api = new ApiClient().buildClient(StoreApi.class);
}
private static WireMockServer wm = new WireMockServer(options().dynamicPort());
/**
* Delete purchase order by ID
*
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*/
@Test
public void deleteOrderTest() {
String orderId = null;
// api.deleteOrder(orderId);
@BeforeAll
static void setup() {
wm.start();
// TODO: test validations
}
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(wm.baseUrl());
api = apiClient.buildClient(StoreApi.class);
/**
* Returns pet inventories by status
*
* Returns a map of status codes to quantities
*/
@Test
public void getInventoryTest() {
// Map<String, Integer> response = api.getInventory();
}
// TODO: test validations
}
@AfterAll
static void shutdown() {
wm.shutdown();
}
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
*/
@Test
public void getOrderByIdTest() {
Long orderId = null;
// Order response = api.getOrderById(orderId);
// TODO: test validations
}
/**
* Delete purchase order by ID
* <p>
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*/
@Test
void deleteOrderTest() {
wm.stubFor(delete(urlEqualTo("/store/order/1234"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok()));
/**
* Place an order for a pet
*
*
*/
@Test
public void placeOrderTest() {
Order body = null;
// Order response = api.placeOrder(body);
api.deleteOrder("1234");
}
// TODO: test validations
}
@Test
void deleteOrderTestInvalid() {
wm.stubFor(delete(urlEqualTo("/store/order/abc"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(aResponse().withStatus(400)));
assertThrows(FeignException.BadRequest.class, () -> api.deleteOrder("abc"));
}
/**
* Returns pet inventories by status
* <p>
* Returns a map of status codes to quantities
*/
@Test
void getInventoryTest() {
wm.stubFor(get(urlEqualTo("/store/inventory"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok("{\n" +
" \"prop1\": 1,\n" +
" \"prop2\": 2\n" +
"}")));
Map<String, Integer> inventory = api.getInventory();
assertThat(inventory.keySet().size(), is(2));
assertThat(inventory.get("prop1"), is(1));
assertThat(inventory.get("prop2"), is(2));
}
/**
* Find purchase order by ID
* <p>
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
*/
@Test
void getOrderByIdTest() {
String responseBody = "{\n" +
" \"id\": 1,\n" +
" \"petId\": 1,\n" +
" \"quantity\": 10,\n" +
" \"shipDate\": \"2120-03-23T01:23:44.000000009+0000\",\n" +
" \"status\": \"placed\",\n" +
" \"complete\": true\n" +
"}";
wm.stubFor(get(urlEqualTo("/store/order/123"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok(responseBody)));
Order order = api.getOrderById(123L);
assertThat(order.getId(), is(1L));
assertThat(order.getPetId(), is(1L));
assertThat(order.getQuantity(), is(10));
assertThat(order.getShipDate(), is(OffsetDateTime.of(2120, 03, 23, 01, 23, 44, 9, ZoneOffset.UTC)));
assertThat(order.getStatus(), is(Order.StatusEnum.PLACED));
assertThat(order.isComplete(), is(true));
}
/**
* Place an order for a pet
*/
@Test
void placeOrderTest() {
String responseBody = "{\n" +
" \"id\": 1,\n" +
" \"petId\": 1,\n" +
" \"quantity\": 10,\n" +
" \"shipDate\": \"2120-03-23T01:23:44.000000009+0000\",\n" +
" \"status\": \"placed\",\n" +
" \"complete\": true\n" +
"}";
Order newOrder = new Order();
newOrder.setId(1L);
newOrder.setPetId(1L);
newOrder.setQuantity(10);
newOrder.shipDate(OffsetDateTime.of(2120, 03, 23, 01, 23, 44, 9, ZoneOffset.UTC));
newOrder.setStatus(Order.StatusEnum.PLACED);
newOrder.setComplete(Boolean.TRUE);
wm.stubFor(post(urlEqualTo("/store/order"))
.withHeader("Accept", equalTo("application/json"))
.willReturn(ok(responseBody)));
Order order = api.placeOrder(newOrder);
assertThat(order, is(newOrder));
}
}

View File

@@ -1,24 +1,21 @@
package org.openapitools.client.api;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.User;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* API tests for UserApi
*/
public class UserApiTest {
class UserApiTest {
private UserApi api;
@Before
public void setup() {
@BeforeEach
void setup() {
api = new ApiClient().buildClient(UserApi.class);
}
@@ -29,7 +26,7 @@ public class UserApiTest {
* This can only be done by the logged in user.
*/
@Test
public void createUserTest() {
void createUserTest() {
User body = null;
// api.createUser(body);
@@ -43,7 +40,7 @@ public class UserApiTest {
*
*/
@Test
public void createUsersWithArrayInputTest() {
void createUsersWithArrayInputTest() {
List<User> body = null;
// api.createUsersWithArrayInput(body);
@@ -57,7 +54,7 @@ public class UserApiTest {
*
*/
@Test
public void createUsersWithListInputTest() {
void createUsersWithListInputTest() {
List<User> body = null;
// api.createUsersWithListInput(body);
@@ -71,7 +68,7 @@ public class UserApiTest {
* This can only be done by the logged in user.
*/
@Test
public void deleteUserTest() {
void deleteUserTest() {
String username = null;
// api.deleteUser(username);
@@ -85,7 +82,7 @@ public class UserApiTest {
*
*/
@Test
public void getUserByNameTest() {
void getUserByNameTest() {
String username = null;
// User response = api.getUserByName(username);
@@ -99,7 +96,7 @@ public class UserApiTest {
*
*/
@Test
public void loginUserTest() {
void loginUserTest() {
String username = null;
String password = null;
// String response = api.loginUser(username, password);
@@ -116,7 +113,7 @@ public class UserApiTest {
* listing them out individually.
*/
@Test
public void loginUserTestQueryMap() {
void loginUserTestQueryMap() {
UserApi.LoginUserQueryParams queryParams = new UserApi.LoginUserQueryParams()
.username(null)
.password(null);
@@ -131,7 +128,7 @@ public class UserApiTest {
*
*/
@Test
public void logoutUserTest() {
void logoutUserTest() {
// api.logoutUser();
// TODO: test validations
@@ -144,7 +141,7 @@ public class UserApiTest {
* This can only be done by the logged in user.
*/
@Test
public void updateUserTest() {
void updateUserTest() {
String username = null;
User body = null;
// api.updateUser(username, body);

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesAnyType
*/
public class AdditionalPropertiesAnyTypeTest {
class AdditionalPropertiesAnyTypeTest {
private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType();
/**
* Model tests for AdditionalPropertiesAnyType
*/
@Test
public void testAdditionalPropertiesAnyType() {
void testAdditionalPropertiesAnyType() {
// TODO: test AdditionalPropertiesAnyType
}
@@ -44,7 +43,7 @@ public class AdditionalPropertiesAnyTypeTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,28 +16,27 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesArray
*/
public class AdditionalPropertiesArrayTest {
class AdditionalPropertiesArrayTest {
private final AdditionalPropertiesArray model = new AdditionalPropertiesArray();
/**
* Model tests for AdditionalPropertiesArray
*/
@Test
public void testAdditionalPropertiesArray() {
void testAdditionalPropertiesArray() {
// TODO: test AdditionalPropertiesArray
}
@@ -45,7 +44,7 @@ public class AdditionalPropertiesArrayTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesBoolean
*/
public class AdditionalPropertiesBooleanTest {
class AdditionalPropertiesBooleanTest {
private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean();
/**
* Model tests for AdditionalPropertiesBoolean
*/
@Test
public void testAdditionalPropertiesBoolean() {
void testAdditionalPropertiesBoolean() {
// TODO: test AdditionalPropertiesBoolean
}
@@ -44,7 +43,7 @@ public class AdditionalPropertiesBooleanTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,6 +16,7 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -23,22 +24,20 @@ import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesClass
*/
public class AdditionalPropertiesClassTest {
class AdditionalPropertiesClassTest {
private final AdditionalPropertiesClass model = new AdditionalPropertiesClass();
/**
* Model tests for AdditionalPropertiesClass
*/
@Test
public void testAdditionalPropertiesClass() {
void testAdditionalPropertiesClass() {
// TODO: test AdditionalPropertiesClass
}
@@ -46,7 +45,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapString'
*/
@Test
public void mapStringTest() {
void mapStringTest() {
// TODO: test mapString
}
@@ -54,7 +53,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapNumber'
*/
@Test
public void mapNumberTest() {
void mapNumberTest() {
// TODO: test mapNumber
}
@@ -62,7 +61,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapInteger'
*/
@Test
public void mapIntegerTest() {
void mapIntegerTest() {
// TODO: test mapInteger
}
@@ -70,7 +69,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapBoolean'
*/
@Test
public void mapBooleanTest() {
void mapBooleanTest() {
// TODO: test mapBoolean
}
@@ -78,7 +77,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapArrayInteger'
*/
@Test
public void mapArrayIntegerTest() {
void mapArrayIntegerTest() {
// TODO: test mapArrayInteger
}
@@ -86,7 +85,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapArrayAnytype'
*/
@Test
public void mapArrayAnytypeTest() {
void mapArrayAnytypeTest() {
// TODO: test mapArrayAnytype
}
@@ -94,7 +93,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapMapString'
*/
@Test
public void mapMapStringTest() {
void mapMapStringTest() {
// TODO: test mapMapString
}
@@ -102,7 +101,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'mapMapAnytype'
*/
@Test
public void mapMapAnytypeTest() {
void mapMapAnytypeTest() {
// TODO: test mapMapAnytype
}
@@ -110,7 +109,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'anytype1'
*/
@Test
public void anytype1Test() {
void anytype1Test() {
// TODO: test anytype1
}
@@ -118,7 +117,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'anytype2'
*/
@Test
public void anytype2Test() {
void anytype2Test() {
// TODO: test anytype2
}
@@ -126,7 +125,7 @@ public class AdditionalPropertiesClassTest {
* Test the property 'anytype3'
*/
@Test
public void anytype3Test() {
void anytype3Test() {
// TODO: test anytype3
}

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesInteger
*/
public class AdditionalPropertiesIntegerTest {
class AdditionalPropertiesIntegerTest {
private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger();
/**
* Model tests for AdditionalPropertiesInteger
*/
@Test
public void testAdditionalPropertiesInteger() {
void testAdditionalPropertiesInteger() {
// TODO: test AdditionalPropertiesInteger
}
@@ -44,7 +43,7 @@ public class AdditionalPropertiesIntegerTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,28 +16,27 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesNumber
*/
public class AdditionalPropertiesNumberTest {
class AdditionalPropertiesNumberTest {
private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber();
/**
* Model tests for AdditionalPropertiesNumber
*/
@Test
public void testAdditionalPropertiesNumber() {
void testAdditionalPropertiesNumber() {
// TODO: test AdditionalPropertiesNumber
}
@@ -45,7 +44,7 @@ public class AdditionalPropertiesNumberTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesObject
*/
public class AdditionalPropertiesObjectTest {
class AdditionalPropertiesObjectTest {
private final AdditionalPropertiesObject model = new AdditionalPropertiesObject();
/**
* Model tests for AdditionalPropertiesObject
*/
@Test
public void testAdditionalPropertiesObject() {
void testAdditionalPropertiesObject() {
// TODO: test AdditionalPropertiesObject
}
@@ -44,7 +43,7 @@ public class AdditionalPropertiesObjectTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for AdditionalPropertiesString
*/
public class AdditionalPropertiesStringTest {
class AdditionalPropertiesStringTest {
private final AdditionalPropertiesString model = new AdditionalPropertiesString();
/**
* Model tests for AdditionalPropertiesString
*/
@Test
public void testAdditionalPropertiesString() {
void testAdditionalPropertiesString() {
// TODO: test AdditionalPropertiesString
}
@@ -44,7 +43,7 @@ public class AdditionalPropertiesStringTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -18,28 +18,27 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
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;
import org.junit.jupiter.api.Test;
/**
* Model tests for Animal
*/
public class AnimalTest {
class AnimalTest {
private final Animal model = new Animal();
/**
* Model tests for Animal
*/
@Test
public void testAnimal() {
void testAnimal() {
// TODO: test Animal
}
@@ -47,7 +46,7 @@ public class AnimalTest {
* Test the property 'className'
*/
@Test
public void classNameTest() {
void classNameTest() {
// TODO: test className
}
@@ -55,7 +54,7 @@ public class AnimalTest {
* Test the property 'color'
*/
@Test
public void colorTest() {
void colorTest() {
// TODO: test color
}

View File

@@ -16,28 +16,27 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for ArrayOfArrayOfNumberOnly
*/
public class ArrayOfArrayOfNumberOnlyTest {
class ArrayOfArrayOfNumberOnlyTest {
private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly();
/**
* Model tests for ArrayOfArrayOfNumberOnly
*/
@Test
public void testArrayOfArrayOfNumberOnly() {
void testArrayOfArrayOfNumberOnly() {
// TODO: test ArrayOfArrayOfNumberOnly
}
@@ -45,7 +44,7 @@ public class ArrayOfArrayOfNumberOnlyTest {
* Test the property 'arrayArrayNumber'
*/
@Test
public void arrayArrayNumberTest() {
void arrayArrayNumberTest() {
// TODO: test arrayArrayNumber
}

View File

@@ -16,28 +16,27 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for ArrayOfNumberOnly
*/
public class ArrayOfNumberOnlyTest {
class ArrayOfNumberOnlyTest {
private final ArrayOfNumberOnly model = new ArrayOfNumberOnly();
/**
* Model tests for ArrayOfNumberOnly
*/
@Test
public void testArrayOfNumberOnly() {
void testArrayOfNumberOnly() {
// TODO: test ArrayOfNumberOnly
}
@@ -45,7 +44,7 @@ public class ArrayOfNumberOnlyTest {
* Test the property 'arrayNumber'
*/
@Test
public void arrayNumberTest() {
void arrayNumberTest() {
// TODO: test arrayNumber
}

View File

@@ -16,28 +16,27 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ReadOnlyFirst;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for ArrayTest
*/
public class ArrayTestTest {
class ArrayTestTest {
private final ArrayTest model = new ArrayTest();
/**
* Model tests for ArrayTest
*/
@Test
public void testArrayTest() {
void testArrayTest() {
// TODO: test ArrayTest
}
@@ -45,7 +44,7 @@ public class ArrayTestTest {
* Test the property 'arrayOfString'
*/
@Test
public void arrayOfStringTest() {
void arrayOfStringTest() {
// TODO: test arrayOfString
}
@@ -53,7 +52,7 @@ public class ArrayTestTest {
* Test the property 'arrayArrayOfInteger'
*/
@Test
public void arrayArrayOfIntegerTest() {
void arrayArrayOfIntegerTest() {
// TODO: test arrayArrayOfInteger
}
@@ -61,7 +60,7 @@ public class ArrayTestTest {
* Test the property 'arrayArrayOfModel'
*/
@Test
public void arrayArrayOfModelTest() {
void arrayArrayOfModelTest() {
// TODO: test arrayArrayOfModel
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for BigCatAllOf
*/
public class BigCatAllOfTest {
class BigCatAllOfTest {
private final BigCatAllOf model = new BigCatAllOf();
/**
* Model tests for BigCatAllOf
*/
@Test
public void testBigCatAllOf() {
void testBigCatAllOf() {
// TODO: test BigCatAllOf
}
@@ -42,7 +41,7 @@ public class BigCatAllOfTest {
* Test the property 'kind'
*/
@Test
public void kindTest() {
void kindTest() {
// TODO: test kind
}

View File

@@ -18,27 +18,26 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.BigCatAllOf;
import org.openapitools.client.model.Cat;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for BigCat
*/
public class BigCatTest {
class BigCatTest {
private final BigCat model = new BigCat();
/**
* Model tests for BigCat
*/
@Test
public void testBigCat() {
void testBigCat() {
// TODO: test BigCat
}
@@ -46,7 +45,7 @@ public class BigCatTest {
* Test the property 'className'
*/
@Test
public void classNameTest() {
void classNameTest() {
// TODO: test className
}
@@ -54,7 +53,7 @@ public class BigCatTest {
* Test the property 'color'
*/
@Test
public void colorTest() {
void colorTest() {
// TODO: test color
}
@@ -62,7 +61,7 @@ public class BigCatTest {
* Test the property 'declawed'
*/
@Test
public void declawedTest() {
void declawedTest() {
// TODO: test declawed
}
@@ -70,7 +69,7 @@ public class BigCatTest {
* Test the property 'kind'
*/
@Test
public void kindTest() {
void kindTest() {
// TODO: test kind
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Capitalization
*/
public class CapitalizationTest {
class CapitalizationTest {
private final Capitalization model = new Capitalization();
/**
* Model tests for Capitalization
*/
@Test
public void testCapitalization() {
void testCapitalization() {
// TODO: test Capitalization
}
@@ -42,7 +41,7 @@ public class CapitalizationTest {
* Test the property 'smallCamel'
*/
@Test
public void smallCamelTest() {
void smallCamelTest() {
// TODO: test smallCamel
}
@@ -50,7 +49,7 @@ public class CapitalizationTest {
* Test the property 'capitalCamel'
*/
@Test
public void capitalCamelTest() {
void capitalCamelTest() {
// TODO: test capitalCamel
}
@@ -58,7 +57,7 @@ public class CapitalizationTest {
* Test the property 'smallSnake'
*/
@Test
public void smallSnakeTest() {
void smallSnakeTest() {
// TODO: test smallSnake
}
@@ -66,7 +65,7 @@ public class CapitalizationTest {
* Test the property 'capitalSnake'
*/
@Test
public void capitalSnakeTest() {
void capitalSnakeTest() {
// TODO: test capitalSnake
}
@@ -74,7 +73,7 @@ public class CapitalizationTest {
* Test the property 'scAETHFlowPoints'
*/
@Test
public void scAETHFlowPointsTest() {
void scAETHFlowPointsTest() {
// TODO: test scAETHFlowPoints
}
@@ -82,7 +81,7 @@ public class CapitalizationTest {
* Test the property 'ATT_NAME'
*/
@Test
public void ATT_NAMETest() {
void ATT_NAMETest() {
// TODO: test ATT_NAME
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for CatAllOf
*/
public class CatAllOfTest {
class CatAllOfTest {
private final CatAllOf model = new CatAllOf();
/**
* Model tests for CatAllOf
*/
@Test
public void testCatAllOf() {
void testCatAllOf() {
// TODO: test CatAllOf
}
@@ -42,7 +41,7 @@ public class CatAllOfTest {
* Test the property 'declawed'
*/
@Test
public void declawedTest() {
void declawedTest() {
// TODO: test declawed
}

View File

@@ -18,28 +18,27 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Animal;
import org.openapitools.client.model.BigCat;
import org.openapitools.client.model.CatAllOf;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Cat
*/
public class CatTest {
class CatTest {
private final Cat model = new Cat();
/**
* Model tests for Cat
*/
@Test
public void testCat() {
void testCat() {
// TODO: test Cat
}
@@ -47,7 +46,7 @@ public class CatTest {
* Test the property 'className'
*/
@Test
public void classNameTest() {
void classNameTest() {
// TODO: test className
}
@@ -55,7 +54,7 @@ public class CatTest {
* Test the property 'color'
*/
@Test
public void colorTest() {
void colorTest() {
// TODO: test color
}
@@ -63,7 +62,7 @@ public class CatTest {
* Test the property 'declawed'
*/
@Test
public void declawedTest() {
void declawedTest() {
// TODO: test declawed
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Category
*/
public class CategoryTest {
class CategoryTest {
private final Category model = new Category();
/**
* Model tests for Category
*/
@Test
public void testCategory() {
void testCategory() {
// TODO: test Category
}
@@ -42,7 +41,7 @@ public class CategoryTest {
* Test the property 'id'
*/
@Test
public void idTest() {
void idTest() {
// TODO: test id
}
@@ -50,7 +49,7 @@ public class CategoryTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for ClassModel
*/
public class ClassModelTest {
class ClassModelTest {
private final ClassModel model = new ClassModel();
/**
* Model tests for ClassModel
*/
@Test
public void testClassModel() {
void testClassModel() {
// TODO: test ClassModel
}
@@ -42,7 +41,7 @@ public class ClassModelTest {
* Test the property 'propertyClass'
*/
@Test
public void propertyClassTest() {
void propertyClassTest() {
// TODO: test propertyClass
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Client
*/
public class ClientTest {
class ClientTest {
private final Client model = new Client();
/**
* Model tests for Client
*/
@Test
public void testClient() {
void testClient() {
// TODO: test Client
}
@@ -42,7 +41,7 @@ public class ClientTest {
* Test the property 'client'
*/
@Test
public void clientTest() {
void clientTest() {
// TODO: test client
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for DogAllOf
*/
public class DogAllOfTest {
class DogAllOfTest {
private final DogAllOf model = new DogAllOf();
/**
* Model tests for DogAllOf
*/
@Test
public void testDogAllOf() {
void testDogAllOf() {
// TODO: test DogAllOf
}
@@ -42,7 +41,7 @@ public class DogAllOfTest {
* Test the property 'breed'
*/
@Test
public void breedTest() {
void breedTest() {
// TODO: test breed
}

View File

@@ -18,27 +18,26 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Animal;
import org.openapitools.client.model.DogAllOf;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Dog
*/
public class DogTest {
class DogTest {
private final Dog model = new Dog();
/**
* Model tests for Dog
*/
@Test
public void testDog() {
void testDog() {
// TODO: test Dog
}
@@ -46,7 +45,7 @@ public class DogTest {
* Test the property 'className'
*/
@Test
public void classNameTest() {
void classNameTest() {
// TODO: test className
}
@@ -54,7 +53,7 @@ public class DogTest {
* Test the property 'color'
*/
@Test
public void colorTest() {
void colorTest() {
// TODO: test color
}
@@ -62,7 +61,7 @@ public class DogTest {
* Test the property 'breed'
*/
@Test
public void breedTest() {
void breedTest() {
// TODO: test breed
}

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for EnumArrays
*/
public class EnumArraysTest {
class EnumArraysTest {
private final EnumArrays model = new EnumArrays();
/**
* Model tests for EnumArrays
*/
@Test
public void testEnumArrays() {
void testEnumArrays() {
// TODO: test EnumArrays
}
@@ -44,7 +43,7 @@ public class EnumArraysTest {
* Test the property 'justSymbol'
*/
@Test
public void justSymbolTest() {
void justSymbolTest() {
// TODO: test justSymbol
}
@@ -52,7 +51,7 @@ public class EnumArraysTest {
* Test the property 'arrayEnum'
*/
@Test
public void arrayEnumTest() {
void arrayEnumTest() {
// TODO: test arrayEnum
}

View File

@@ -13,20 +13,18 @@
package org.openapitools.client.model;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for EnumClass
*/
public class EnumClassTest {
class EnumClassTest {
/**
* Model tests for EnumClass
*/
@Test
public void testEnumClass() {
void testEnumClass() {
// TODO: test EnumClass
}

View File

@@ -16,26 +16,25 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.OuterEnum;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for EnumTest
*/
public class EnumTestTest {
class EnumTestTest {
private final EnumTest model = new EnumTest();
/**
* Model tests for EnumTest
*/
@Test
public void testEnumTest() {
void testEnumTest() {
// TODO: test EnumTest
}
@@ -43,7 +42,7 @@ public class EnumTestTest {
* Test the property 'enumString'
*/
@Test
public void enumStringTest() {
void enumStringTest() {
// TODO: test enumString
}
@@ -51,7 +50,7 @@ public class EnumTestTest {
* Test the property 'enumStringRequired'
*/
@Test
public void enumStringRequiredTest() {
void enumStringRequiredTest() {
// TODO: test enumStringRequired
}
@@ -59,7 +58,7 @@ public class EnumTestTest {
* Test the property 'enumInteger'
*/
@Test
public void enumIntegerTest() {
void enumIntegerTest() {
// TODO: test enumInteger
}
@@ -67,7 +66,7 @@ public class EnumTestTest {
* Test the property 'enumNumber'
*/
@Test
public void enumNumberTest() {
void enumNumberTest() {
// TODO: test enumNumber
}
@@ -75,7 +74,7 @@ public class EnumTestTest {
* Test the property 'outerEnum'
*/
@Test
public void outerEnumTest() {
void outerEnumTest() {
// TODO: test outerEnum
}

View File

@@ -16,27 +16,26 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for FileSchemaTestClass
*/
public class FileSchemaTestClassTest {
class FileSchemaTestClassTest {
private final FileSchemaTestClass model = new FileSchemaTestClass();
/**
* Model tests for FileSchemaTestClass
*/
@Test
public void testFileSchemaTestClass() {
void testFileSchemaTestClass() {
// TODO: test FileSchemaTestClass
}
@@ -44,7 +43,7 @@ public class FileSchemaTestClassTest {
* Test the property 'file'
*/
@Test
public void fileTest() {
void fileTest() {
// TODO: test file
}
@@ -52,7 +51,7 @@ public class FileSchemaTestClassTest {
* Test the property 'files'
*/
@Test
public void filesTest() {
void filesTest() {
// TODO: test files
}

View File

@@ -16,6 +16,7 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -24,22 +25,20 @@ import java.math.BigDecimal;
import java.util.UUID;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for FormatTest
*/
public class FormatTestTest {
class FormatTestTest {
private final FormatTest model = new FormatTest();
/**
* Model tests for FormatTest
*/
@Test
public void testFormatTest() {
void testFormatTest() {
// TODO: test FormatTest
}
@@ -47,7 +46,7 @@ public class FormatTestTest {
* Test the property 'integer'
*/
@Test
public void integerTest() {
void integerTest() {
// TODO: test integer
}
@@ -55,7 +54,7 @@ public class FormatTestTest {
* Test the property 'int32'
*/
@Test
public void int32Test() {
void int32Test() {
// TODO: test int32
}
@@ -63,7 +62,7 @@ public class FormatTestTest {
* Test the property 'int64'
*/
@Test
public void int64Test() {
void int64Test() {
// TODO: test int64
}
@@ -71,7 +70,7 @@ public class FormatTestTest {
* Test the property 'number'
*/
@Test
public void numberTest() {
void numberTest() {
// TODO: test number
}
@@ -79,7 +78,7 @@ public class FormatTestTest {
* Test the property '_float'
*/
@Test
public void _floatTest() {
void _floatTest() {
// TODO: test _float
}
@@ -87,7 +86,7 @@ public class FormatTestTest {
* Test the property '_double'
*/
@Test
public void _doubleTest() {
void _doubleTest() {
// TODO: test _double
}
@@ -95,7 +94,7 @@ public class FormatTestTest {
* Test the property 'string'
*/
@Test
public void stringTest() {
void stringTest() {
// TODO: test string
}
@@ -103,7 +102,7 @@ public class FormatTestTest {
* Test the property '_byte'
*/
@Test
public void _byteTest() {
void _byteTest() {
// TODO: test _byte
}
@@ -111,7 +110,7 @@ public class FormatTestTest {
* Test the property 'binary'
*/
@Test
public void binaryTest() {
void binaryTest() {
// TODO: test binary
}
@@ -119,7 +118,7 @@ public class FormatTestTest {
* Test the property 'date'
*/
@Test
public void dateTest() {
void dateTest() {
// TODO: test date
}
@@ -127,7 +126,7 @@ public class FormatTestTest {
* Test the property 'dateTime'
*/
@Test
public void dateTimeTest() {
void dateTimeTest() {
// TODO: test dateTime
}
@@ -135,7 +134,7 @@ public class FormatTestTest {
* Test the property 'uuid'
*/
@Test
public void uuidTest() {
void uuidTest() {
// TODO: test uuid
}
@@ -143,7 +142,7 @@ public class FormatTestTest {
* Test the property 'password'
*/
@Test
public void passwordTest() {
void passwordTest() {
// TODO: test password
}
@@ -151,7 +150,7 @@ public class FormatTestTest {
* Test the property 'bigDecimal'
*/
@Test
public void bigDecimalTest() {
void bigDecimalTest() {
// TODO: test bigDecimal
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for HasOnlyReadOnly
*/
public class HasOnlyReadOnlyTest {
class HasOnlyReadOnlyTest {
private final HasOnlyReadOnly model = new HasOnlyReadOnly();
/**
* Model tests for HasOnlyReadOnly
*/
@Test
public void testHasOnlyReadOnly() {
void testHasOnlyReadOnly() {
// TODO: test HasOnlyReadOnly
}
@@ -42,7 +41,7 @@ public class HasOnlyReadOnlyTest {
* Test the property 'bar'
*/
@Test
public void barTest() {
void barTest() {
// TODO: test bar
}
@@ -50,7 +49,7 @@ public class HasOnlyReadOnlyTest {
* Test the property 'foo'
*/
@Test
public void fooTest() {
void fooTest() {
// TODO: test foo
}

View File

@@ -16,28 +16,27 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for MapTest
*/
public class MapTestTest {
class MapTestTest {
private final MapTest model = new MapTest();
/**
* Model tests for MapTest
*/
@Test
public void testMapTest() {
void testMapTest() {
// TODO: test MapTest
}
@@ -45,7 +44,7 @@ public class MapTestTest {
* Test the property 'mapMapOfString'
*/
@Test
public void mapMapOfStringTest() {
void mapMapOfStringTest() {
// TODO: test mapMapOfString
}
@@ -53,7 +52,7 @@ public class MapTestTest {
* Test the property 'mapOfEnumString'
*/
@Test
public void mapOfEnumStringTest() {
void mapOfEnumStringTest() {
// TODO: test mapOfEnumString
}
@@ -61,7 +60,7 @@ public class MapTestTest {
* Test the property 'directMap'
*/
@Test
public void directMapTest() {
void directMapTest() {
// TODO: test directMap
}
@@ -69,7 +68,7 @@ public class MapTestTest {
* Test the property 'indirectMap'
*/
@Test
public void indirectMapTest() {
void indirectMapTest() {
// TODO: test indirectMap
}

View File

@@ -16,6 +16,7 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -25,22 +26,20 @@ import java.util.Map;
import java.util.UUID;
import org.openapitools.client.model.Animal;
import org.threeten.bp.OffsetDateTime;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for MixedPropertiesAndAdditionalPropertiesClass
*/
public class MixedPropertiesAndAdditionalPropertiesClassTest {
class MixedPropertiesAndAdditionalPropertiesClassTest {
private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass();
/**
* Model tests for MixedPropertiesAndAdditionalPropertiesClass
*/
@Test
public void testMixedPropertiesAndAdditionalPropertiesClass() {
void testMixedPropertiesAndAdditionalPropertiesClass() {
// TODO: test MixedPropertiesAndAdditionalPropertiesClass
}
@@ -48,7 +47,7 @@ public class MixedPropertiesAndAdditionalPropertiesClassTest {
* Test the property 'uuid'
*/
@Test
public void uuidTest() {
void uuidTest() {
// TODO: test uuid
}
@@ -56,7 +55,7 @@ public class MixedPropertiesAndAdditionalPropertiesClassTest {
* Test the property 'dateTime'
*/
@Test
public void dateTimeTest() {
void dateTimeTest() {
// TODO: test dateTime
}
@@ -64,7 +63,7 @@ public class MixedPropertiesAndAdditionalPropertiesClassTest {
* Test the property 'map'
*/
@Test
public void mapTest() {
void mapTest() {
// TODO: test map
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Model200Response
*/
public class Model200ResponseTest {
class Model200ResponseTest {
private final Model200Response model = new Model200Response();
/**
* Model tests for Model200Response
*/
@Test
public void testModel200Response() {
void testModel200Response() {
// TODO: test Model200Response
}
@@ -42,7 +41,7 @@ public class Model200ResponseTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}
@@ -50,7 +49,7 @@ public class Model200ResponseTest {
* Test the property 'propertyClass'
*/
@Test
public void propertyClassTest() {
void propertyClassTest() {
// TODO: test propertyClass
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for ModelApiResponse
*/
public class ModelApiResponseTest {
class ModelApiResponseTest {
private final ModelApiResponse model = new ModelApiResponse();
/**
* Model tests for ModelApiResponse
*/
@Test
public void testModelApiResponse() {
void testModelApiResponse() {
// TODO: test ModelApiResponse
}
@@ -42,7 +41,7 @@ public class ModelApiResponseTest {
* Test the property 'code'
*/
@Test
public void codeTest() {
void codeTest() {
// TODO: test code
}
@@ -50,7 +49,7 @@ public class ModelApiResponseTest {
* Test the property 'type'
*/
@Test
public void typeTest() {
void typeTest() {
// TODO: test type
}
@@ -58,7 +57,7 @@ public class ModelApiResponseTest {
* Test the property 'message'
*/
@Test
public void messageTest() {
void messageTest() {
// TODO: test message
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for ModelReturn
*/
public class ModelReturnTest {
class ModelReturnTest {
private final ModelReturn model = new ModelReturn();
/**
* Model tests for ModelReturn
*/
@Test
public void testModelReturn() {
void testModelReturn() {
// TODO: test ModelReturn
}
@@ -42,7 +41,7 @@ public class ModelReturnTest {
* Test the property '_return'
*/
@Test
public void _returnTest() {
void _returnTest() {
// TODO: test _return
}

View File

@@ -16,25 +16,24 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Name
*/
public class NameTest {
class NameTest {
private final Name model = new Name();
/**
* Model tests for Name
*/
@Test
public void testName() {
void testName() {
// TODO: test Name
}
@@ -42,7 +41,7 @@ public class NameTest {
* Test the property 'name'
*/
@Test
public void nameTest() {
void nameTest() {
// TODO: test name
}
@@ -50,7 +49,7 @@ public class NameTest {
* Test the property 'snakeCase'
*/
@Test
public void snakeCaseTest() {
void snakeCaseTest() {
// TODO: test snakeCase
}
@@ -58,7 +57,7 @@ public class NameTest {
* Test the property 'property'
*/
@Test
public void propertyTest() {
void propertyTest() {
// TODO: test property
}
@@ -66,7 +65,7 @@ public class NameTest {
* Test the property '_123number'
*/
@Test
public void _123numberTest() {
void _123numberTest() {
// TODO: test _123number
}

View File

@@ -16,26 +16,25 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for NumberOnly
*/
public class NumberOnlyTest {
class NumberOnlyTest {
private final NumberOnly model = new NumberOnly();
/**
* Model tests for NumberOnly
*/
@Test
public void testNumberOnly() {
void testNumberOnly() {
// TODO: test NumberOnly
}
@@ -43,7 +42,7 @@ public class NumberOnlyTest {
* Test the property 'justNumber'
*/
@Test
public void justNumberTest() {
void justNumberTest() {
// TODO: test justNumber
}

View File

@@ -16,26 +16,25 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.threeten.bp.OffsetDateTime;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for Order
*/
public class OrderTest {
class OrderTest {
private final Order model = new Order();
/**
* Model tests for Order
*/
@Test
public void testOrder() {
void testOrder() {
// TODO: test Order
}
@@ -43,7 +42,7 @@ public class OrderTest {
* Test the property 'id'
*/
@Test
public void idTest() {
void idTest() {
// TODO: test id
}
@@ -51,7 +50,7 @@ public class OrderTest {
* Test the property 'petId'
*/
@Test
public void petIdTest() {
void petIdTest() {
// TODO: test petId
}
@@ -59,7 +58,7 @@ public class OrderTest {
* Test the property 'quantity'
*/
@Test
public void quantityTest() {
void quantityTest() {
// TODO: test quantity
}
@@ -67,7 +66,7 @@ public class OrderTest {
* Test the property 'shipDate'
*/
@Test
public void shipDateTest() {
void shipDateTest() {
// TODO: test shipDate
}
@@ -75,7 +74,7 @@ public class OrderTest {
* Test the property 'status'
*/
@Test
public void statusTest() {
void statusTest() {
// TODO: test status
}
@@ -83,7 +82,7 @@ public class OrderTest {
* Test the property 'complete'
*/
@Test
public void completeTest() {
void completeTest() {
// TODO: test complete
}

View File

@@ -16,26 +16,25 @@ package org.openapitools.client.model;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for OuterComposite
*/
public class OuterCompositeTest {
class OuterCompositeTest {
private final OuterComposite model = new OuterComposite();
/**
* Model tests for OuterComposite
*/
@Test
public void testOuterComposite() {
void testOuterComposite() {
// TODO: test OuterComposite
}
@@ -43,7 +42,7 @@ public class OuterCompositeTest {
* Test the property 'myNumber'
*/
@Test
public void myNumberTest() {
void myNumberTest() {
// TODO: test myNumber
}
@@ -51,7 +50,7 @@ public class OuterCompositeTest {
* Test the property 'myString'
*/
@Test
public void myStringTest() {
void myStringTest() {
// TODO: test myString
}
@@ -59,7 +58,7 @@ public class OuterCompositeTest {
* Test the property 'myBoolean'
*/
@Test
public void myBooleanTest() {
void myBooleanTest() {
// TODO: test myBoolean
}

View File

@@ -13,20 +13,18 @@
package org.openapitools.client.model;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Model tests for OuterEnum
*/
public class OuterEnumTest {
class OuterEnumTest {
/**
* Model tests for OuterEnum
*/
@Test
public void testOuterEnum() {
void testOuterEnum() {
// TODO: test OuterEnum
}

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