mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
[Java][resteasy] Add tests to upload files (#16534)
* add test to upload files (resteasy) * remove resteasy tests from github workflow
This commit is contained in:
parent
026fa514c3
commit
c614b9d9b1
@ -43,7 +43,6 @@ jobs:
|
||||
- samples/client/petstore/java/webclient-swagger2
|
||||
- samples/client/petstore/java/vertx
|
||||
- samples/client/petstore/java/jersey2-java8-localdatetime
|
||||
- samples/client/petstore/java/resteasy
|
||||
- samples/client/petstore/java/google-api-client
|
||||
- samples/client/petstore/java/rest-assured
|
||||
- samples/client/petstore/java/rest-assured-jackson
|
||||
@ -78,4 +77,4 @@ jobs:
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: mvn clean package
|
||||
run: mvn clean package
|
||||
|
1
pom.xml
1
pom.xml
@ -1292,6 +1292,7 @@
|
||||
<module>samples/client/others/java/okhttp-gson-streaming</module>
|
||||
<module>samples/client/petstore/java/okhttp-gson</module>
|
||||
<module>samples/client/petstore/java/okhttp-gson-3.1</module>
|
||||
<module>samples/client/petstore/java/resteasy</module>
|
||||
<module>samples/client/petstore/java-micronaut-client</module>
|
||||
<module>samples/client/petstore/java/apache-httpclient</module>
|
||||
</modules>
|
||||
|
@ -14,20 +14,21 @@
|
||||
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;
|
||||
import java.util.Set;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* API tests for PetApi
|
||||
@ -170,17 +171,19 @@ public class PetApiTest {
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void uploadFileTest() throws ApiException {
|
||||
//
|
||||
//Long petId = null;
|
||||
//
|
||||
//String additionalMetadata = null;
|
||||
//
|
||||
//File _file = null;
|
||||
//
|
||||
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file);
|
||||
|
||||
// TODO: test validations
|
||||
public void uploadFileTest() throws Exception {
|
||||
Long petId = 1L;
|
||||
String additionalMetadata = "additoinal data";
|
||||
File file = new File("test.txt");
|
||||
if(!file.exists()){
|
||||
file.createNewFile();
|
||||
}
|
||||
FileWriter fw = new FileWriter(file);
|
||||
fw.write("testing only");
|
||||
fw.close();
|
||||
file.deleteOnExit();
|
||||
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||
Assert.assertEquals((long)response.getCode(), 200);
|
||||
}
|
||||
/**
|
||||
* uploads an image (required)
|
||||
|
Loading…
x
Reference in New Issue
Block a user