-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better java resteasy echo api client tests
- Loading branch information
Showing
89 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
bin/configs/java-resteasy-echo.yaml → bin/configs/java-resteasy-echo-api.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions
73
samples/client/echo_api/java/resteasy/src/test/java/org/openapitools/client/CustomTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Echo Server API | ||
* Echo Server API | ||
* | ||
* The version of the OpenAPI document: 0.1.0 | ||
* Contact: [email protected] | ||
* | ||
* 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.api; | ||
|
||
import org.openapitools.client.ApiException; | ||
import java.io.File; | ||
import org.openapitools.client.model.Pet; | ||
import org.openapitools.client.model.Tag; | ||
import org.junit.Test; | ||
import org.junit.Ignore; | ||
import org.junit.Assert; | ||
|
||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.time.LocalDate; | ||
import java.time.OffsetDateTime; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.hamcrest.CoreMatchers.containsString; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* API tests | ||
*/ | ||
public class CustomTest { | ||
|
||
private final BodyApi api = new BodyApi(); | ||
|
||
/** | ||
* Test single binary in multipart mime | ||
* | ||
* @see | ||
* <a href="https://github.com/OpenAPITools/openapi-generator/issues/17367">#17367</a> | ||
*/ | ||
@Test | ||
public void testBodyMultipartFormdataSingleBinaryTest() throws ApiException, IOException { | ||
File myFile = new File("test.txt"); | ||
if (!myFile.exists()){ | ||
assertTrue(myFile.createNewFile()); | ||
} | ||
FileWriter fw = new FileWriter(myFile); | ||
fw.write("testing only"); | ||
fw.close(); | ||
myFile.deleteOnExit(); | ||
|
||
String response = | ||
api.testBodyMultipartFormdataSingleBinary(myFile); | ||
|
||
EchoServerResponseParser parser = | ||
new EchoServerResponseParser(response); | ||
|
||
String contentDisposition = parser.headers.get("Content-Disposition"); | ||
|
||
assertThat(contentDisposition, containsString( | ||
"form-data; name=\"my-file\"; filename=\"test.txt\"" | ||
)); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.