1 package com.github.javaparser.symbolsolver;
2 
3 import com.github.javaparser.JavaParser;
4 import com.github.javaparser.ParseException;
5 import com.github.javaparser.ast.CompilationUnit;
6 import com.github.javaparser.ast.expr.MethodCallExpr;
7 import com.github.javaparser.resolution.MethodUsage;
8 import com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;
9 import com.github.javaparser.symbolsolver.resolution.AbstractResolutionTest;
10 import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver;
11 import org.junit.Test;
12 import static org.junit.Assert.*;
13 
14 public class Issue228 extends AbstractResolutionTest{
15 
16     @Test
testSolvingMethodWitPrimitiveParameterTypeAsUsage()17     public void testSolvingMethodWitPrimitiveParameterTypeAsUsage() {
18         String code =
19                   "class Test { "
20                 + "  long l = call(1); "
21                 + "  long call(final long i) { "
22                 + "    return i; "
23                 + "  }"
24                 + "}";
25         CompilationUnit cu = JavaParser.parse(code);
26         MethodCallExpr methodCall = cu.findAll(MethodCallExpr.class).get(0);
27         JavaParserFacade parserFacade = JavaParserFacade.get(new ReflectionTypeSolver());
28         MethodUsage solvedCall = parserFacade.solveMethodAsUsage(methodCall);
29         assertEquals("long", solvedCall.getParamType(0).describe());
30     }
31 }
32