use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.
the class ImplUsageProviderTest method TestIsImplicitUsageForClass.
@Test
public void TestIsImplicitUsageForClass() throws Exception {
ModuleHelper helper = mock(ModuleHelper.class);
PsiClass c = mock(PsiClassImpl.class);
PsiMethod method = mock(PsiMethod.class);
PsiModifierList list = mock(PsiModifierList.class);
PsiAnnotation annotation = mock(PsiAnnotation.class);
when(annotation.getQualifiedName()).thenReturn(BeforeStep.class.getCanonicalName());
when(list.getAnnotations()).thenReturn(new PsiAnnotation[] { annotation });
when(method.getModifierList()).thenReturn(list);
when(c.getMethods()).thenReturn(new PsiMethod[] { method });
when(helper.isGaugeModule(c)).thenReturn(true);
boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(c);
assertTrue(isUsed);
}
use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.
the class ImplUsageProviderTest method TestIsImplicitUsageForMethodParameter.
@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);
}
use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.
the class ImplUsageProviderTest method TestIsImplicitUsageForHook.
@Test
public void TestIsImplicitUsageForHook() throws Exception {
ModuleHelper helper = mock(ModuleHelper.class);
PsiMethod method = mock(PsiMethod.class);
PsiModifierList list = mock(PsiModifierList.class);
PsiAnnotation annotation = mock(PsiAnnotation.class);
when(annotation.getQualifiedName()).thenReturn(BeforeStep.class.getCanonicalName());
when(list.getAnnotations()).thenReturn(new PsiAnnotation[] { annotation });
when(method.getModifierList()).thenReturn(list);
when(helper.isGaugeModule(method)).thenReturn(true);
boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(method);
assertTrue(isUsed);
}
use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.
the class ImplUsageProviderTest method TestIsImplicitUsageForClassWithNoMethods.
@Test
public void TestIsImplicitUsageForClassWithNoMethods() throws Exception {
ModuleHelper helper = mock(ModuleHelper.class);
PsiClass c = mock(PsiClassImpl.class);
when(helper.isGaugeModule(c)).thenReturn(true);
when(c.getMethods()).thenReturn(new PsiMethod[] {});
boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(c);
assertFalse(isUsed);
}
use of com.thoughtworks.gauge.helper.ModuleHelper in project Intellij-Plugin by getgauge.
the class ImplUsageProviderTest method TestIsImplicitUsageWithNoElement.
@Test
public void TestIsImplicitUsageWithNoElement() throws Exception {
ModuleHelper helper = mock(ModuleHelper.class);
boolean isUsed = new ImplUsageProvider(null, helper).isImplicitUsage(null);
assertFalse(isUsed);
}
Aggregations