Skip to content

Commit a912130

Browse files
committed
Added test
1 parent d6ea713 commit a912130

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.swagger.parserExtensions;
2+
3+
import io.swagger.models.Swagger;
4+
import io.swagger.parser.SwaggerCompatConverter;
5+
import org.testng.annotations.Test;
6+
7+
import java.io.IOException;
8+
9+
import static org.testng.Assert.assertTrue;
10+
11+
public class SwaggerCompatConverterTest {
12+
@Test
13+
public void loadsSpecFromClasspath() throws IOException {
14+
SwaggerCompatConverter converter = new SwaggerCompatConverter();
15+
Swagger result = converter.read("/specs/v1_2/singleFile.json");
16+
assertTrue(result != null, "Didn't load spec from classpath");
17+
}
18+
19+
@Test
20+
public void failsOnNonExistentSpec() throws IOException {
21+
SwaggerCompatConverter converter = new SwaggerCompatConverter();
22+
Swagger result = converter.read("specs/v1_2/not-exists.json");
23+
assertTrue(result == null);
24+
}
25+
}

0 commit comments

Comments
 (0)