@@ -180,7 +180,6 @@ public void testIssue1169() {
180
180
assertNotNull (apispec );
181
181
}
182
182
183
-
184
183
@ Test
185
184
public void testIssue339 () throws Exception {
186
185
OpenAPIV3Parser openAPIV3Parser = new OpenAPIV3Parser ();
@@ -522,7 +521,6 @@ public void testPattern() {
522
521
Assert .assertEquals (s .getPattern (),"^[A-Z]+$" ); //ERROR: got null
523
522
}
524
523
525
-
526
524
@ BeforeClass
527
525
private void setUpWireMockServer () throws IOException {
528
526
this .wireMockServer = new WireMockServer (WireMockConfiguration .wireMockConfig ().dynamicPort ());
@@ -867,7 +865,6 @@ public void int64ExampleWithoutOverflow() throws Exception {
867
865
Assert .assertEquals ("1516042231144" , date .getExample ().toString ());
868
866
}
869
867
870
-
871
868
@ Test
872
869
public void testRefPaths () throws Exception {
873
870
String yaml = "openapi: '3.0.0'\n " +
@@ -1234,10 +1231,8 @@ public void testIssue() {
1234
1231
1235
1232
assertEquals (((Map ) openAPI .getExtensions ().get ("x-some-vendor" )).get ("sometesting" ), "bye!" );
1236
1233
assertEquals (openAPI .getPaths ().get ("/foo" ).getExtensions ().get ("x-something" ), "yes, it is supported" );
1237
-
1238
1234
}
1239
1235
1240
-
1241
1236
@ Test
1242
1237
public void testIssue292WithCSVCollectionFormat () {
1243
1238
String yaml =
@@ -1898,7 +1893,7 @@ public void shouldParseParameters() {
1898
1893
assertEquals (parameter .getIn (), "path" );
1899
1894
assertEquals (parameter .getName (), "playerId" );
1900
1895
}
1901
-
1896
+
1902
1897
@ Test
1903
1898
public void testIssue884 () {
1904
1899
ParseOptions parseOptions = new ParseOptions ();
@@ -1910,7 +1905,7 @@ public void testIssue884() {
1910
1905
assertEquals (operationId , "getRepository" );
1911
1906
assertNotNull (userRepository .getHeaders ());
1912
1907
}
1913
-
1908
+
1914
1909
@ Test
1915
1910
public void testLinkIssue () {
1916
1911
ParseOptions parseOptions = new ParseOptions ();
@@ -2067,10 +2062,10 @@ public void shouldParseApiWithMultipleParameterReferences() {
2067
2062
2068
2063
@ Test
2069
2064
public void shouldParseApiWithParametersUsingContentvsSchema () {
2070
- // Tests that the content method of specifying the format of a parameter
2071
- // gets resolved.
2072
- // Test checks if an API's single parameter of array type gets fully resolved to
2073
- // referenced definitions.
2065
+ // Tests that the content method of specifying the format of a parameter
2066
+ // gets resolved.
2067
+ // Test checks if an API's single parameter of array type gets fully resolved to
2068
+ // referenced definitions.
2074
2069
String location = "src/test/resources/issue-1078/api.yaml" ;
2075
2070
ParseOptions options = new ParseOptions ();
2076
2071
options .setResolve (true );
@@ -2261,7 +2256,7 @@ public void testSampleParser() {
2261
2256
}
2262
2257
2263
2258
@ Test
2264
- public void testDuplicateHttpStatusCodes () {
2259
+ public void testDuplicateHttpStatusCodesJson () {
2265
2260
final String location = "src/test/resources/duplicateHttpStatusCodes.json" ;
2266
2261
2267
2262
final ParseOptions options = new ParseOptions ();
@@ -2276,6 +2271,22 @@ public void testDuplicateHttpStatusCodes() {
2276
2271
2277
2272
}
2278
2273
2274
+ @ Test
2275
+ public void testDuplicateHttpStatusCodesYaml () {
2276
+ final String location = "src/test/resources/duplicateHttpStatusCodes.yaml" ;
2277
+
2278
+ final ParseOptions options = new ParseOptions ();
2279
+ options .setResolve (true );
2280
+
2281
+ final OpenAPIV3Parser parser = new OpenAPIV3Parser ();
2282
+ final SwaggerParseResult result = parser .readLocation (location , null , options );
2283
+ assertNull (result .getOpenAPI ());
2284
+ List <String > messages = result .getMessages ();
2285
+ assertEquals (1 , messages .size ());
2286
+ assertEquals (messages .get (0 ), "Duplicate field '200' in `src/test/resources/duplicateHttpStatusCodes.yaml`" );
2287
+
2288
+ }
2289
+
2279
2290
private static int getDynamicPort () {
2280
2291
return new Random ().ints (10000 , 20000 ).findFirst ().getAsInt ();
2281
2292
}
0 commit comments