Search in sources :

Example 6 with ModuleHelper

use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.

the class ImplUsageProviderTest method TestIsImplicitUsageForNonGaugeElement.

@Test
public void TestIsImplicitUsageForNonGaugeElement() throws Exception {
    ModuleHelper helper = mock(ModuleHelper.class);
    PsiMethod method = mock(PsiMethod.class);
    PsiModifierList list = mock(PsiModifierList.class);
    when(list.getAnnotations()).thenReturn(new PsiAnnotation[] {});
    when(method.getModifierList()).thenReturn(list);
    when(helper.isGaugeModule(method)).thenReturn(true);
    boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(method);
    assertFalse(isUsed);
}
Also used : ModuleHelper(com.thoughtworks.gauge.helper.ModuleHelper) Test(org.junit.Test)

Example 7 with ModuleHelper

use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.

the class SpecStepImplTest method testShouldGetReferenceInGaugeModule.

@Test
public void testShouldGetReferenceInGaugeModule() throws Exception {
    ModuleHelper helper = mock(ModuleHelper.class);
    ASTNode node = mock(ASTNode.class);
    SpecStepImpl specStep = new SpecStepImpl(node, helper);
    when(helper.isGaugeModule(specStep)).thenReturn(true);
    PsiReference reference = specStep.getReference();
    assertEquals(reference.getClass(), StepReference.class);
}
Also used : ModuleHelper(com.thoughtworks.gauge.helper.ModuleHelper) ASTNode(com.intellij.lang.ASTNode) PsiReference(com.intellij.psi.PsiReference) Test(org.junit.Test)

Example 8 with ModuleHelper

use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.

the class SpecStepImplTest method testShouldNotGetReferenceInNonGaugeModule.

@Test
public void testShouldNotGetReferenceInNonGaugeModule() throws Exception {
    ModuleHelper helper = mock(ModuleHelper.class);
    ASTNode node = mock(ASTNode.class);
    SpecStepImpl specStep = new SpecStepImpl(node, helper);
    when(helper.isGaugeModule(specStep)).thenReturn(false);
    PsiReference reference = specStep.getReference();
    assertNull(reference);
}
Also used : ModuleHelper(com.thoughtworks.gauge.helper.ModuleHelper) ASTNode(com.intellij.lang.ASTNode) PsiReference(com.intellij.psi.PsiReference) Test(org.junit.Test)

Example 9 with ModuleHelper

use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.

the class ImplUsageProviderTest method TestIsImplicitUsageWithNoModule.

@Test
public void TestIsImplicitUsageWithNoModule() throws Exception {
    ModuleHelper helper = mock(ModuleHelper.class);
    boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(mock(PsiElement.class));
    assertFalse(isUsed);
}
Also used : ModuleHelper(com.thoughtworks.gauge.helper.ModuleHelper) Test(org.junit.Test)

Example 10 with ModuleHelper

use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.

the class ConceptStepImplTest method testShouldNotGetReferenceInNonGaugeModule.

@Test
public void testShouldNotGetReferenceInNonGaugeModule() throws Exception {
    ModuleHelper helper = mock(ModuleHelper.class);
    ASTNode node = mock(ASTNode.class);
    ConceptStepImpl conceptStep = new ConceptStepImpl(node, helper);
    when(helper.isGaugeModule(conceptStep)).thenReturn(false);
    PsiReference reference = conceptStep.getReference();
    assertNull(reference);
}
Also used : ModuleHelper(com.thoughtworks.gauge.helper.ModuleHelper) ASTNode(com.intellij.lang.ASTNode) PsiReference(com.intellij.psi.PsiReference) Test(org.junit.Test)

Aggregations

ModuleHelper (com.thoughtworks.gauge.helper.ModuleHelper)11 Test (org.junit.Test)11 ASTNode (com.intellij.lang.ASTNode)4 PsiReference (com.intellij.psi.PsiReference)4 BeforeStep (com.thoughtworks.gauge.BeforeStep)2 SpecStep (com.thoughtworks.gauge.language.psi.SpecStep)1