@Test public void TestIsImplicitUsageForMethodParameter() throws Exception { ModuleHelper helper = mock(ModuleHelper.class); SpecStep element = mock(SpecStepImpl.class); PsiParameter parameter = mock(PsiParameterImpl.class); when(parameter.getDeclarationScope()).thenReturn(element); when(helper.isGaugeModule(parameter)).thenReturn(true); boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(parameter); assertTrue(isUsed); }
@Override public PsiParameter createPsi(@NotNull ASTNode node) { return new PsiParameterImpl(node); }
public boolean isImplicitUsage(PsiElement element) { if (element == null || !moduleHelper.isGaugeModule(element)) return false; if (element instanceof PsiClassImpl) return isClassUsed((PsiClassImpl) element); if (element instanceof PsiParameterImpl) return isParameterUsed((PsiParameterImpl) element); return isElementUsed(element); }
private boolean isParameterUsed(PsiParameterImpl element) { return GaugeUtil.isGaugeElement(element.getDeclarationScope()); }
@Override public PsiParameter createPsi(@NotNull ASTNode node) { boolean receiver = node.getElementType() == JavaElementType.RECEIVER_PARAMETER; return receiver ? new PsiReceiverParameterImpl(node) : new PsiParameterImpl(node); }