Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add test case for the issue #2349
- Loading branch information
Jean-Pierre Lerbscher
committed
Sep 15, 2020
1 parent
7953905
commit 52a09d7
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/Issue2349Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.github.javaparser.symbolsolver; | ||
|
||
import com.github.javaparser.ParserConfiguration; | ||
import com.github.javaparser.StaticJavaParser; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; | ||
import com.github.javaparser.resolution.types.ResolvedReferenceType; | ||
import com.github.javaparser.symbolsolver.resolution.AbstractResolutionTest; | ||
import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver; | ||
import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver; | ||
import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static com.github.javaparser.StaticJavaParser.parse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
|
||
public class Issue2349Test extends AbstractResolutionTest { | ||
|
||
@BeforeEach | ||
void setUp() { | ||
CombinedTypeSolver cts = new CombinedTypeSolver(new ReflectionTypeSolver(), | ||
new JavaParserTypeSolver("src/test/resources/issue2349")); | ||
ParserConfiguration config = new ParserConfiguration(); | ||
config.setSymbolResolver(new JavaSymbolSolver(cts)); | ||
StaticJavaParser.setConfiguration(config); | ||
} | ||
|
||
@Test | ||
void test() throws FileNotFoundException { | ||
CompilationUnit cu = parse(new File("src/test/resources/issue2349/foo/Bar.java")); | ||
List<ClassOrInterfaceDeclaration> decls = cu.findAll(ClassOrInterfaceDeclaration.class); | ||
ResolvedReferenceType rrt = decls.get(0).getExtendedTypes().getFirst().get().resolve(); | ||
assertTrue("bar.Bar".equals(rrt.describe())); | ||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
javaparser-symbol-solver-testing/src/test/resources/issue2349/bar/Bar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
package bar; | ||
public class Bar {} |
2 changes: 2 additions & 0 deletions
2
javaparser-symbol-solver-testing/src/test/resources/issue2349/foo/Bar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
package foo; | ||
public class Bar extends bar.Bar {} |