From 33a1ac439734a2af2e3d7813b040322bc62fa651 Mon Sep 17 00:00:00 2001 From: moreginger Date: Sun, 21 Oct 2018 15:01:47 +0100 Subject: [PATCH] Don't generate unused ApiException class for java/webclient. (#1165) --- .../codegen/languages/JavaClientCodegen.java | 5 +- .../Java/libraries/webclient/api.mustache | 3 +- .../libraries/webclient/api_test.mustache | 6 +- .../org/openapitools/client/ApiException.java | 91 ------------------- .../openapitools/client/Configuration.java | 39 -------- .../java/org/openapitools/client/Pair.java | 61 ------------- .../client/api/AnotherFakeApi.java | 1 - .../org/openapitools/client/api/FakeApi.java | 1 - .../client/api/FakeClassnameTags123Api.java | 1 - .../org/openapitools/client/api/PetApi.java | 1 - .../org/openapitools/client/api/StoreApi.java | 1 - .../org/openapitools/client/api/UserApi.java | 1 - .../client/api/AnotherFakeApiTest.java | 6 +- .../openapitools/client/api/FakeApiTest.java | 67 +++++--------- .../api/FakeClassnameTags123ApiTest.java | 6 +- .../openapitools/client/api/PetApiTest.java | 50 +++------- .../openapitools/client/api/StoreApiTest.java | 21 +---- .../openapitools/client/api/UserApiTest.java | 41 ++------- 18 files changed, 56 insertions(+), 346 deletions(-) delete mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java delete mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java delete mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 8bbaec641c7..39969fdfbfb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -269,10 +269,13 @@ public class JavaClientCodegen extends AbstractJavaCodegen apiDocTemplateFiles.remove("api_doc.mustache"); } - if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) { + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java")); supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java")); supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java")); + } + + if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) { supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache index 9c3f9fb140c..c29a160fc4f 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache @@ -5,8 +5,7 @@ import {{invokerPackage}}.ApiClient; {{#imports}}import {{import}}; {{/imports}} -{{^fullJavaUtil}}import java.util.ArrayList; -import java.util.HashMap; +{{^fullJavaUtil}}import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map;{{/fullJavaUtil}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache index f1dca2f41cf..1b730bf43a7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api_test.mustache @@ -2,7 +2,6 @@ package {{package}}; -import {{invokerPackage}}.ApiException; {{#imports}}import {{import}}; {{/imports}} import org.junit.Test; @@ -28,12 +27,9 @@ public class {{classname}}Test { * {{summary}} * * {{notes}} - * - * @throws ApiException - * if the Api call fails */ @Test - public void {{operationId}}Test() throws ApiException { + public void {{operationId}}Test() { {{#allParams}} {{{dataType}}} {{paramName}} = null; {{/allParams}} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java deleted file mode 100644 index 6f360360783..00000000000 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiException.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client; - -import java.util.Map; -import java.util.List; - - -public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java deleted file mode 100644 index 1545483fe0b..00000000000 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Configuration.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client; - - -public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java deleted file mode 100644 index 0619e8c408b..00000000000 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client; - - -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 845a1e5cde9..fd44d8122f8 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.Client; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index a6edb74655d..bd18f677378 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -11,7 +11,6 @@ import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; import org.openapitools.client.model.User; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 15f1d2e6791..31e95c77ccb 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.Client; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java index febe863feda..a746058c7f7 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -6,7 +6,6 @@ import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java index 383bc7ace0f..c4747ea723a 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.Order; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java index 4b38490e704..89bcf01c8ae 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -4,7 +4,6 @@ import org.openapitools.client.ApiClient; import org.openapitools.client.model.User; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java index 6f593f9144d..e0487304635 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.Client; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class AnotherFakeApiTest { * To test special tags * * To test special tags and operation ID starting with number - * - * @throws ApiException - * if the Api call fails */ @Test - public void call123testSpecialTagsTest() throws ApiException { + public void call123testSpecialTagsTest() { Client client = null; Client response = api.call123testSpecialTags(client).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java index be858a81953..9c1ca7fdc04 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -13,10 +13,10 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import java.math.BigDecimal; import org.openapitools.client.model.Client; import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; import java.time.LocalDate; import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; @@ -42,12 +42,9 @@ public class FakeApiTest { * * * Test serialization of outer boolean types - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterBooleanSerializeTest() throws ApiException { + public void fakeOuterBooleanSerializeTest() { Boolean body = null; Boolean response = api.fakeOuterBooleanSerialize(body).block(); @@ -58,12 +55,9 @@ public class FakeApiTest { * * * Test serialization of object with outer number type - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterCompositeSerializeTest() throws ApiException { + public void fakeOuterCompositeSerializeTest() { OuterComposite outerComposite = null; OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite).block(); @@ -74,12 +68,9 @@ public class FakeApiTest { * * * Test serialization of outer number types - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterNumberSerializeTest() throws ApiException { + public void fakeOuterNumberSerializeTest() { BigDecimal body = null; BigDecimal response = api.fakeOuterNumberSerialize(body).block(); @@ -90,12 +81,9 @@ public class FakeApiTest { * * * Test serialization of outer string types - * - * @throws ApiException - * if the Api call fails */ @Test - public void fakeOuterStringSerializeTest() throws ApiException { + public void fakeOuterStringSerializeTest() { String body = null; String response = api.fakeOuterStringSerialize(body).block(); @@ -105,13 +93,23 @@ public class FakeApiTest { /** * * - * - * - * @throws ApiException - * if the Api call fails + * For this test, the body for this request much reference a schema named `File`. */ @Test - public void testBodyWithQueryParamsTest() throws ApiException { + public void testBodyWithFileSchemaTest() { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass).block(); + + // TODO: test validations + } + + /** + * + * + * + */ + @Test + public void testBodyWithQueryParamsTest() { String query = null; User user = null; api.testBodyWithQueryParams(query, user).block(); @@ -123,12 +121,9 @@ public class FakeApiTest { * To test \"client\" model * * To test \"client\" model - * - * @throws ApiException - * if the Api call fails */ @Test - public void testClientModelTest() throws ApiException { + public void testClientModelTest() { Client client = null; Client response = api.testClientModel(client).block(); @@ -139,12 +134,9 @@ public class FakeApiTest { * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * - * @throws ApiException - * if the Api call fails */ @Test - public void testEndpointParametersTest() throws ApiException { + public void testEndpointParametersTest() { BigDecimal number = null; Double _double = null; String patternWithoutDelimiter = null; @@ -168,12 +160,9 @@ public class FakeApiTest { * To test enum parameters * * To test enum parameters - * - * @throws ApiException - * if the Api call fails */ @Test - public void testEnumParametersTest() throws ApiException { + public void testEnumParametersTest() { List enumHeaderStringArray = null; String enumHeaderString = null; List enumQueryStringArray = null; @@ -191,12 +180,9 @@ public class FakeApiTest { * test inline additionalProperties * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void testInlineAdditionalPropertiesTest() throws ApiException { + public void testInlineAdditionalPropertiesTest() { Map requestBody = null; api.testInlineAdditionalProperties(requestBody).block(); @@ -207,12 +193,9 @@ public class FakeApiTest { * test json serialization of form data * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void testJsonFormDataTest() throws ApiException { + public void testJsonFormDataTest() { String param = null; String param2 = null; api.testJsonFormData(param, param2).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java index dfa7edd396a..ffa015e8f5f 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.Client; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class FakeClassnameTags123ApiTest { * To test class name in snake case * * To test class name in snake case - * - * @throws ApiException - * if the Api call fails */ @Test - public void testClassnameTest() throws ApiException { + public void testClassnameTest() { Client client = null; Client response = api.testClassname(client).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java index a03056a49df..463aec5a426 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; @@ -38,12 +37,9 @@ public class PetApiTest { * Add a new pet to the store * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void addPetTest() throws ApiException { + public void addPetTest() { Pet pet = null; api.addPet(pet).block(); @@ -54,12 +50,9 @@ public class PetApiTest { * Deletes a pet * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void deletePetTest() throws ApiException { + public void deletePetTest() { Long petId = null; String apiKey = null; api.deletePet(petId, apiKey).block(); @@ -71,12 +64,9 @@ public class PetApiTest { * Finds Pets by status * * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails */ @Test - public void findPetsByStatusTest() throws ApiException { + public void findPetsByStatusTest() { List status = null; List response = api.findPetsByStatus(status).collectList().block(); @@ -87,12 +77,9 @@ public class PetApiTest { * Finds Pets by tags * * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails */ @Test - public void findPetsByTagsTest() throws ApiException { + public void findPetsByTagsTest() { List tags = null; List response = api.findPetsByTags(tags).collectList().block(); @@ -103,12 +90,9 @@ public class PetApiTest { * Find pet by ID * * Returns a single pet - * - * @throws ApiException - * if the Api call fails */ @Test - public void getPetByIdTest() throws ApiException { + public void getPetByIdTest() { Long petId = null; Pet response = api.getPetById(petId).block(); @@ -119,12 +103,9 @@ public class PetApiTest { * Update an existing pet * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void updatePetTest() throws ApiException { + public void updatePetTest() { Pet pet = null; api.updatePet(pet).block(); @@ -135,12 +116,9 @@ public class PetApiTest { * Updates a pet in the store with form data * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void updatePetWithFormTest() throws ApiException { + public void updatePetWithFormTest() { Long petId = null; String name = null; String status = null; @@ -153,12 +131,9 @@ public class PetApiTest { * uploads an image * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void uploadFileTest() throws ApiException { + public void uploadFileTest() { Long petId = null; String additionalMetadata = null; File file = null; @@ -171,16 +146,13 @@ public class PetApiTest { * uploads an image (required) * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void uploadFileWithRequiredFileTest() throws ApiException { + public void uploadFileWithRequiredFileTest() { Long petId = null; - File file = null; + File requiredFile = null; String additionalMetadata = null; - ModelApiResponse response = api.uploadFileWithRequiredFile(petId, file, additionalMetadata).block(); + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata).block(); // TODO: test validations } diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java index 477e4c1af00..09fb1c5a1b2 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.Order; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class StoreApiTest { * Delete purchase order by ID * * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails */ @Test - public void deleteOrderTest() throws ApiException { + public void deleteOrderTest() { String orderId = null; api.deleteOrder(orderId).block(); @@ -52,12 +48,9 @@ public class StoreApiTest { * Returns pet inventories by status * * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails */ @Test - public void getInventoryTest() throws ApiException { + public void getInventoryTest() { Map response = api.getInventory().block(); // TODO: test validations @@ -67,12 +60,9 @@ public class StoreApiTest { * Find purchase order by ID * * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails */ @Test - public void getOrderByIdTest() throws ApiException { + public void getOrderByIdTest() { Long orderId = null; Order response = api.getOrderById(orderId).block(); @@ -83,12 +73,9 @@ public class StoreApiTest { * Place an order for a pet * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void placeOrderTest() throws ApiException { + public void placeOrderTest() { Order order = null; Order response = api.placeOrder(order).block(); diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java index ce86e5d94ba..146f6b08bce 100644 --- a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -13,7 +13,6 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; import org.openapitools.client.model.User; import org.junit.Test; import org.junit.Ignore; @@ -36,12 +35,9 @@ public class UserApiTest { * Create user * * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails */ @Test - public void createUserTest() throws ApiException { + public void createUserTest() { User user = null; api.createUser(user).block(); @@ -52,12 +48,9 @@ public class UserApiTest { * Creates list of users with given input array * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void createUsersWithArrayInputTest() throws ApiException { + public void createUsersWithArrayInputTest() { List user = null; api.createUsersWithArrayInput(user).block(); @@ -68,12 +61,9 @@ public class UserApiTest { * Creates list of users with given input array * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void createUsersWithListInputTest() throws ApiException { + public void createUsersWithListInputTest() { List user = null; api.createUsersWithListInput(user).block(); @@ -84,12 +74,9 @@ public class UserApiTest { * Delete user * * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails */ @Test - public void deleteUserTest() throws ApiException { + public void deleteUserTest() { String username = null; api.deleteUser(username).block(); @@ -100,12 +87,9 @@ public class UserApiTest { * Get user by user name * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void getUserByNameTest() throws ApiException { + public void getUserByNameTest() { String username = null; User response = api.getUserByName(username).block(); @@ -116,12 +100,9 @@ public class UserApiTest { * Logs user into the system * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void loginUserTest() throws ApiException { + public void loginUserTest() { String username = null; String password = null; String response = api.loginUser(username, password).block(); @@ -133,12 +114,9 @@ public class UserApiTest { * Logs out current logged in user session * * - * - * @throws ApiException - * if the Api call fails */ @Test - public void logoutUserTest() throws ApiException { + public void logoutUserTest() { api.logoutUser().block(); // TODO: test validations @@ -148,12 +126,9 @@ public class UserApiTest { * Updated user * * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails */ @Test - public void updateUserTest() throws ApiException { + public void updateUserTest() { String username = null; User user = null; api.updateUser(username, user).block();