|
5 | 5 | import issues.i1601.App1601; |
6 | 6 | import issues.i1601.App1601b; |
7 | 7 |
|
8 | | -import static org.junit.jupiter.api.Assertions.assertEquals; |
| 8 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
9 | 9 |
|
10 | 10 | public class Issue1601 { |
11 | 11 |
|
12 | 12 | @OpenAPITest(value = App1601.class) |
13 | 13 | public void shouldParseOpenAPIDefinition(OpenAPIResult result) { |
14 | | - assertEquals("openapi: 3.0.1\n" |
| 14 | + String yaml1 = "openapi: 3.0.1\n" |
15 | 15 | + "info:\n" |
16 | 16 | + " title: Title\n" |
17 | 17 | + " description: description\n" |
@@ -49,12 +49,53 @@ public void shouldParseOpenAPIDefinition(OpenAPIResult result) { |
49 | 49 | + " content:\n" |
50 | 50 | + " application/json:\n" |
51 | 51 | + " schema:\n" |
52 | | - + " type: string\n", result.toYaml()); |
| 52 | + + " type: string\n"; |
| 53 | + String yaml2 = "openapi: 3.0.1\n" |
| 54 | + + "info:\n" |
| 55 | + + " title: Title\n" |
| 56 | + + " description: description\n" |
| 57 | + + " termsOfService: Terms\n" |
| 58 | + + " contact:\n" |
| 59 | + + " name: Jooby\n" |
| 60 | + + " url: https://jooby.io\n" |
| 61 | + + " email: support@jooby.io\n" |
| 62 | + + " license:\n" |
| 63 | + + " name: Apache\n" |
| 64 | + + " url: https://jooby.io/LICENSE\n" |
| 65 | + + " version: \"10\"\n" |
| 66 | + + "servers:\n" |
| 67 | + + "- url: serverurl\n" |
| 68 | + + " description: '...'\n" |
| 69 | + + " variables:\n" |
| 70 | + + " env:\n" |
| 71 | + + " description: environment\n" |
| 72 | + + " enum:\n" |
| 73 | + + " - stage\n" |
| 74 | + + " - prod\n" |
| 75 | + + " default: dev\n" |
| 76 | + + "security:\n" |
| 77 | + + "- oauth:\n" |
| 78 | + + " - read:write\n" |
| 79 | + + "tags:\n" |
| 80 | + + "- name: mytag\n" |
| 81 | + + "paths:\n" |
| 82 | + + " /1601:\n" |
| 83 | + + " get:\n" |
| 84 | + + " operationId: get1601\n" |
| 85 | + + " responses:\n" |
| 86 | + + " \"200\":\n" |
| 87 | + + " description: Success\n" |
| 88 | + + " content:\n" |
| 89 | + + " application/json:\n" |
| 90 | + + " schema:\n" |
| 91 | + + " type: string\n"; |
| 92 | + String output = result.toYaml(); |
| 93 | + assertTrue(output.equals(yaml1) || output.equals(yaml2)); |
53 | 94 | } |
54 | 95 |
|
55 | 96 | @OpenAPITest(value = App1601b.class) |
56 | 97 | public void shouldParseOpenAPIDefinitionController(OpenAPIResult result) { |
57 | | - assertEquals("openapi: 3.0.1\n" |
| 98 | + String yaml1 = "openapi: 3.0.1\n" |
58 | 99 | + "info:\n" |
59 | 100 | + " title: Title\n" |
60 | 101 | + " description: description\n" |
@@ -92,6 +133,47 @@ public void shouldParseOpenAPIDefinitionController(OpenAPIResult result) { |
92 | 133 | + " content:\n" |
93 | 134 | + " application/json:\n" |
94 | 135 | + " schema:\n" |
95 | | - + " type: string\n", result.toYaml()); |
| 136 | + + " type: string\n"; |
| 137 | + String yaml2 = "openapi: 3.0.1\n" |
| 138 | + + "info:\n" |
| 139 | + + " title: Title\n" |
| 140 | + + " description: description\n" |
| 141 | + + " termsOfService: Terms\n" |
| 142 | + + " contact:\n" |
| 143 | + + " name: Jooby\n" |
| 144 | + + " url: https://jooby.io\n" |
| 145 | + + " email: support@jooby.io\n" |
| 146 | + + " license:\n" |
| 147 | + + " name: Apache\n" |
| 148 | + + " url: https://jooby.io/LICENSE\n" |
| 149 | + + " version: \"10\"\n" |
| 150 | + + "servers:\n" |
| 151 | + + "- url: serverurl\n" |
| 152 | + + " description: '...'\n" |
| 153 | + + " variables:\n" |
| 154 | + + " env:\n" |
| 155 | + + " description: environment\n" |
| 156 | + + " enum:\n" |
| 157 | + + " - stage\n" |
| 158 | + + " - prod\n" |
| 159 | + + " default: dev\n" |
| 160 | + + "security:\n" |
| 161 | + + "- oauth:\n" |
| 162 | + + " - read:write\n" |
| 163 | + + "tags:\n" |
| 164 | + + "- name: mytag\n" |
| 165 | + + "paths:\n" |
| 166 | + + " /1601:\n" |
| 167 | + + " get:\n" |
| 168 | + + " operationId: doSomething\n" |
| 169 | + + " responses:\n" |
| 170 | + + " \"200\":\n" |
| 171 | + + " description: Success\n" |
| 172 | + + " content:\n" |
| 173 | + + " application/json:\n" |
| 174 | + + " schema:\n" |
| 175 | + + " type: string\n"; |
| 176 | + String output = result.toYaml(); |
| 177 | + assertTrue(output.equals(yaml1) || output.equals(yaml2)); |
96 | 178 | } |
97 | 179 | } |
0 commit comments