void (PsiReference ref, final String methodName, final String[] expectedTypeParameterValues, @NonNls final String expectedCallType) { PsiElement target = ref.resolve(); assertThat(target, instanceOf(PsiMethod.class)); PsiMethod psiMethod = (PsiMethod)target; assertEquals(methodName, psiMethod.getName()); assertThat(ref.getElement(), instanceOf(PsiJavaCodeReferenceElement.class)); PsiJavaCodeReferenceElement refElement = (PsiJavaCodeReferenceElement)ref.getElement(); JavaResolveResult resolveResult = refElement.advancedResolve(false); PsiSubstitutor substitutor = resolveResult.getSubstitutor(); PsiTypeParameter[] typeParameters = psiMethod.getTypeParameters(); assertEquals(expectedTypeParameterValues.length, typeParameters.length); for (int i = 0; i < expectedTypeParameterValues.length; i++) { String expectedTypeParameterValue = expectedTypeParameterValues[i]; assertTrue(substitutor.substitute(typeParameters[i]).equalsToText(expectedTypeParameterValue)); } PsiType type = ((PsiExpression)refElement.getParent()).getType(); assertTrue(type.equalsToText(expectedCallType)); }