use of com.intellij.testFramework.utils.parameterInfo.MockCreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method testStopAtAccessibleStaticCorrectCandidate.
public void testStopAtAccessibleStaticCorrectCandidate() {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiExpressionList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertEquals(1, itemsToShow.length);
assertEquals(0, ((MethodCandidateInfo) itemsToShow[0]).getElement().getParameterList().getParametersCount());
}
use of com.intellij.testFramework.utils.parameterInfo.MockCreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method testParameterInfoDoesNotShowInternalJetbrainsAnnotations.
public void testParameterInfoDoesNotShowInternalJetbrainsAnnotations() throws IOException {
myFixture.configureByText("x.java", "class X { void f(@org.intellij.lang.annotations.Flow int i) { f(<caret>0); }}");
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiMethod method = PsiTreeUtil.getParentOfType(getFile().findElementAt(context.getOffset()), PsiMethod.class);
assertNotNull(method);
MockParameterInfoUIContext<PsiMethod> uiContext = new MockParameterInfoUIContext<>(method);
String list = MethodParameterInfoHandler.updateMethodPresentation(method, PsiSubstitutor.EMPTY, uiContext);
assertEquals("int i", list);
PsiAnnotation[] annotations = AnnotationUtil.getAllAnnotations(method.getParameterList().getParameters()[0], false, null);
assertEquals(1, annotations.length);
}
use of com.intellij.testFramework.utils.parameterInfo.MockCreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method doTest2CandidatesWithPreselection.
private void doTest2CandidatesWithPreselection() {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiExpressionList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertEquals(2, itemsToShow.length);
assertTrue(itemsToShow[0] instanceof MethodCandidateInfo);
ParameterInfoComponent.createContext(itemsToShow, getEditor(), handler, -1);
MockUpdateParameterInfoContext updateParameterInfoContext = updateParameterInfo(handler, list, itemsToShow);
assertTrue(updateParameterInfoContext.isUIComponentEnabled(0) || updateParameterInfoContext.isUIComponentEnabled(1));
}
use of com.intellij.testFramework.utils.parameterInfo.MockCreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method annoParameterPresentation.
private String annoParameterPresentation() {
AnnotationParameterInfoHandler handler = new AnnotationParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiAnnotationParameterList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertEquals(1, itemsToShow.length);
assertTrue(itemsToShow[0] instanceof PsiAnnotationMethod);
PsiAnnotationMethod method = (PsiAnnotationMethod) itemsToShow[0];
ParameterInfoUIContextEx parameterContext = ParameterInfoComponent.createContext(itemsToShow, getEditor(), handler, -1);
return AnnotationParameterInfoHandler.updateUIText(method, parameterContext);
}
use of com.intellij.testFramework.utils.parameterInfo.MockCreateParameterInfoContext in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoParameterInfoHandlerTest method getItemsToShow.
private Object[] getItemsToShow() {
CreateParameterInfoContext createCtx = new MockCreateParameterInfoContext(myFixture.getEditor(), myFixture.getFile());
GoArgumentList psiElement = myParameterInfoHandler.findElementForParameterInfo(createCtx);
assertNotNull(psiElement);
myParameterInfoHandler.showParameterInfo(psiElement, createCtx);
return createCtx.getItemsToShow();
}
Aggregations