forked from loafle/openapi-generator-original
[java] javaparser 3.24.0 (#11382)
This commit is contained in:
parent
78f4748c06
commit
e9d69f2b45
@ -338,7 +338,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.javaparser</groupId>
|
||||
<artifactId>javaparser-core</artifactId>
|
||||
<version>3.14.11</version>
|
||||
<version>3.24.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -5,8 +5,9 @@ import static org.testng.Assert.fail;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import com.github.javaparser.ParseProblemException;
|
||||
import com.github.javaparser.StaticJavaParser;
|
||||
import com.github.javaparser.JavaParser;
|
||||
import com.github.javaparser.ParserConfiguration;
|
||||
import com.github.javaparser.ParseResult;
|
||||
import com.github.javaparser.ast.CompilationUnit;
|
||||
import io.swagger.parser.OpenAPIParser;
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
@ -150,13 +151,11 @@ public class TestUtils {
|
||||
}
|
||||
|
||||
public static void assertValidJavaSourceCode(String javaSourceCode, String filename) {
|
||||
try {
|
||||
CompilationUnit compilation = StaticJavaParser.parse(javaSourceCode);
|
||||
assertTrue(compilation.getTypes().size() > 0, "File: " + filename);
|
||||
}
|
||||
catch (ParseProblemException ex) {
|
||||
fail("Java parse problem: " + filename, ex);
|
||||
}
|
||||
ParserConfiguration config = new ParserConfiguration();
|
||||
config.setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_11);
|
||||
JavaParser parser = new JavaParser(config);
|
||||
ParseResult<CompilationUnit> parseResult = parser.parse(javaSourceCode);
|
||||
assertTrue(parseResult.isSuccessful(), String.valueOf(parseResult.getProblems()));
|
||||
}
|
||||
|
||||
public static void assertFileContains(Path path, String... lines) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user