@@ -165,62 +165,62 @@ private void tearDownWireMockServer() {
165
165
public void test$idUrlExternal () throws Exception {
166
166
ParseOptions p = new ParseOptions ();
167
167
p .setResolve (true );
168
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-uri-external/root.json" ).getAbsolutePath (), null , p );
168
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-uri-external/root.json" ).toURI (). toASCIIString (), null , p );
169
169
compare ("$id-uri-external" , swaggerParseResult );
170
170
}
171
171
172
172
@ Test
173
173
public void test$idUrlEnclosing () throws Exception {
174
174
ParseOptions p = new ParseOptions ();
175
175
p .setResolve (true );
176
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-uri-enclosing/root.json" ).getAbsolutePath (), null , p );
176
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-uri-enclosing/root.json" ).toURI (). toASCIIString (), null , p );
177
177
compare ("$id-uri-enclosing" , swaggerParseResult );
178
178
}
179
179
180
180
@ Test
181
181
public void test$idUrlDirect () throws Exception {
182
182
ParseOptions p = new ParseOptions ();
183
183
p .setResolve (true );
184
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-uri-direct/root.json" ).getAbsolutePath (), null , p );
184
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-uri-direct/root.json" ).toURI (). toASCIIString (), null , p );
185
185
compare ("$id-uri-direct" , swaggerParseResult );
186
186
}
187
187
@ Test
188
188
public void test$idUrlUnresolvable () throws Exception {
189
189
ParseOptions p = new ParseOptions ();
190
190
p .setResolve (true );
191
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-unresolvable/root.json" ).getAbsolutePath (), null , p );
191
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$id-unresolvable/root.json" ).toURI (). toASCIIString (), null , p );
192
192
compare ("$id-unresolvable" , swaggerParseResult );
193
193
}
194
194
195
195
@ Test
196
196
public void testAnchorExt () throws Exception {
197
197
ParseOptions p = new ParseOptions ();
198
198
p .setResolve (true );
199
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$anchor-external/root.json" ).getAbsolutePath (), null , p );
199
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$anchor-external/root.json" ).toURI (). toASCIIString (), null , p );
200
200
compare ("$anchor-external" , swaggerParseResult );
201
201
}
202
202
203
203
@ Test
204
204
public void testAnchorInt () throws Exception {
205
205
ParseOptions p = new ParseOptions ();
206
206
p .setResolve (true );
207
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$anchor-internal/root.json" ).getAbsolutePath (), null , p );
207
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$anchor-internal/root.json" ).toURI (). toASCIIString (), null , p );
208
208
compare ("$anchor-internal" , swaggerParseResult );
209
209
}
210
210
211
211
@ Test
212
212
public void testAnchorUnresolve () throws Exception {
213
213
ParseOptions p = new ParseOptions ();
214
214
p .setResolve (true );
215
- SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$anchor-not-found/root.json" ).getAbsolutePath (), null , p );
215
+ SwaggerParseResult swaggerParseResult = new OpenAPIV3Parser ().readLocation (new File ("src/test/resources/3.1.0/dereference/schema/$anchor-not-found/root.json" ).toURI (). toASCIIString (), null , p );
216
216
compare ("$anchor-not-found" , swaggerParseResult );
217
217
}
218
218
219
219
public void compare (String dir , SwaggerParseResult result ) throws Exception {
220
220
ObjectMapper mapper = Json31 .mapper ().copy ();
221
221
mapper .configure (SerializationFeature .ORDER_MAP_ENTRIES_BY_KEYS , true );
222
222
mapper .configure (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY , true );
223
- String actual = mapper .writer (new DefaultPrettyPrinter ()).writeValueAsString (result .getOpenAPI ());
223
+ String actual = mapper .writer (new DefaultPrettyPrinter ()).writeValueAsString (result .getOpenAPI ()). replace ( " \r \n " , " \n " ) ;
224
224
org .testng .Assert .assertEquals (actual ,
225
225
FileUtils .readFileToString (new File ("src/test/resources/3.1.0/dereference/schema/" + dir + "/dereferenced.json" )));
226
226
}
0 commit comments