unit test: jersey2, jersey3

This commit is contained in:
sullis 2022-03-16 22:33:31 -07:00
parent 7fc9d73b13
commit 8348a00db9

View File

@ -145,14 +145,34 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest {
return files.stream().collect(Collectors.toMap(e -> e.getName().replace(outputPath, ""), i -> i));
}
@Test
public void testJersey2() throws Exception {
codegen.setLibrary("jersey2");
codegen.setDateLibrary("java8");
final Map<String, File> files = generateFiles(codegen, "src/test/resources/3_0/petstore.yaml");
files.values()
.stream()
.filter(file -> file.getName().endsWith(".java"))
.forEach(file -> {
// Jersey2 uses "javax.ws.rs"
// Let's confirm that "jakarta.ws" is not present
assertFileNotContains(file.toPath(), "jakarta.ws");
});
}
@Test
public void testJersey3() throws Exception {
codegen.setLibrary("jersey3");
codegen.setDateLibrary("java8");
final Map<String, File> files = generateFiles(codegen, "src/test/resources/3_0/form-multipart-binary-array.yaml");
final Map<String, File> files = generateFiles(codegen, "src/test/resources/3_0/petstore.yaml");
files.values().forEach(file -> {
files.values()
.stream()
.filter(file -> file.getName().endsWith(".java"))
.forEach(file -> {
// Jersey3 uses "jakarta.ws.rs"
// Let's confirm that "javax.ws" is not present
assertFileNotContains(file.toPath(), "javax.ws");