-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WebFlux test for YAML support, completes #14
- Loading branch information
Showing
12 changed files
with
163 additions
and
24 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
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
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
11 changes: 11 additions & 0 deletions
11
...r-for-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app37/App37.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,11 @@ | ||
package de.qaware.openapigeneratorforspring.test.app37; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class App37 { | ||
public static void main(String[] args) { | ||
SpringApplication.run(App37.class, args); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...r-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app37/App37Test.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,52 @@ | ||
package de.qaware.openapigeneratorforspring.test.app37; | ||
|
||
import de.qaware.openapigeneratorforspring.test.AbstractOpenApiGeneratorWebFluxBaseIntTest; | ||
import org.junit.Test; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
|
||
public class App37Test extends AbstractOpenApiGeneratorWebFluxBaseIntTest { | ||
|
||
private static final String YAML_FILE = "app37.yaml"; | ||
|
||
@Test | ||
public void getOpenApiAsJson_withAcceptTextHtml() throws Exception { | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("text", "html"))) | ||
.expectStatus().isEqualTo(HttpStatus.NOT_ACCEPTABLE); | ||
} | ||
|
||
@Test | ||
public void getOpenApiAsJson_withAcceptApplicationYaml() throws Exception { | ||
assertResponseBodyMatchesOpenApiYaml(YAML_FILE, | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("application", "yaml"))) | ||
); | ||
} | ||
|
||
@Test | ||
public void getOpenApiAsJson_withAcceptApplicationXYaml() throws Exception { | ||
assertResponseBodyMatchesOpenApiYaml(YAML_FILE, | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("application", "yaml"))) | ||
); | ||
} | ||
|
||
@Test | ||
public void getOpenApiAsJson_withAcceptTextYaml() throws Exception { | ||
assertResponseBodyMatchesOpenApiYaml(YAML_FILE, | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("text", "yaml"))) | ||
); | ||
} | ||
|
||
@Test | ||
public void getOpenApiAsJson_withAcceptTextXYaml() throws Exception { | ||
assertResponseBodyMatchesOpenApiYaml(YAML_FILE, | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("text", "x-yaml"))) | ||
); | ||
} | ||
|
||
@Test | ||
public void getOpenApiAsJson_withAcceptTextVndYaml() throws Exception { | ||
assertResponseBodyMatchesOpenApiYaml(YAML_FILE, | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("text", "vnd.yaml"))) | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...r-for-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app38/App38.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,11 @@ | ||
package de.qaware.openapigeneratorforspring.test.app38; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class App38 { | ||
public static void main(String[] args) { | ||
SpringApplication.run(App38.class, args); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ng-test/src/test/java/de/qaware/openapigeneratorforspring/test/app38/App38Controller.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,14 @@ | ||
package de.qaware.openapigeneratorforspring.test.app38; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class App38Controller { | ||
@GetMapping("mapping1") | ||
public String mapping1(@RequestBody String request, @RequestParam String param1) { | ||
return null; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...r-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app38/App38Test.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,15 @@ | ||
package de.qaware.openapigeneratorforspring.test.app38; | ||
|
||
import de.qaware.openapigeneratorforspring.test.AbstractOpenApiGeneratorWebFluxBaseIntTest; | ||
import org.junit.Test; | ||
import org.springframework.http.MediaType; | ||
|
||
public class App38Test extends AbstractOpenApiGeneratorWebFluxBaseIntTest { | ||
|
||
@Test | ||
public void getOpenApiAsJson() throws Exception { | ||
assertResponseBodyMatchesOpenApiYaml("app38.yaml", | ||
performApiDocsRequest(x -> x, x -> x.accept(new MediaType("application", "yaml"))) | ||
); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
openapi-generator-for-spring-test/src/test/resources/openApiYaml/app37.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: API for App37 | ||
version: unknown | ||
paths: { } |
27 changes: 27 additions & 0 deletions
27
openapi-generator-for-spring-test/src/test/resources/openApiYaml/app38.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: API for App38 | ||
version: unknown | ||
paths: | ||
/mapping1: | ||
get: | ||
operationId: mapping1 | ||
parameters: | ||
- name: param1 | ||
in: query | ||
required: true | ||
schema: | ||
type: string | ||
requestBody: | ||
content: | ||
'*/*': | ||
schema: | ||
type: string | ||
required: true | ||
responses: | ||
"200": | ||
description: Default response | ||
content: | ||
'*/*': | ||
schema: | ||
type: string |