use of com.thoughtworks.gauge.language.psi.impl.SpecStepImpl in project Intellij-Plugin by getgauge.
the class ReferenceSearchHelperTest method testShouldFindReferencesIfGaugeModule.
@Test
public void testShouldFindReferencesIfGaugeModule() throws Exception {
SpecStepImpl element = mock(SpecStepImpl.class);
when(element.getProject()).thenReturn(project);
ReferencesSearch.SearchParameters searchParameters = new ReferencesSearch.SearchParameters(element, scope, true);
when(moduleHelper.isGaugeModule(element)).thenReturn(true);
when(scope.getDisplayName()).thenReturn("Other Scope");
ReferenceSearchHelper referenceSearchHelper = new ReferenceSearchHelper(moduleHelper);
referenceSearchHelper.shouldFindReferences(searchParameters, searchParameters.getElementToSearch());
verify(scope, times(1)).getDisplayName();
}
use of com.thoughtworks.gauge.language.psi.impl.SpecStepImpl in project Intellij-Plugin by getgauge.
the class ReferenceSearchHelperTest method testShouldNotFindReferencesIfNotGaugeModule.
@Test
public void testShouldNotFindReferencesIfNotGaugeModule() throws Exception {
SpecStepImpl element = mock(SpecStepImpl.class);
when(element.getProject()).thenReturn(project);
ReferencesSearch.SearchParameters searchParameters = new ReferencesSearch.SearchParameters(element, scope, true);
when(moduleHelper.isGaugeModule(element)).thenReturn(false);
ReferenceSearchHelper referenceSearchHelper = new ReferenceSearchHelper(moduleHelper);
boolean shouldFindReferences = referenceSearchHelper.shouldFindReferences(searchParameters, searchParameters.getElementToSearch());
assertFalse("Should find reference for non Gauge Module(Expected: false, Actual: true)", shouldFindReferences);
verify(scope, never()).getDisplayName();
}
use of com.thoughtworks.gauge.language.psi.impl.SpecStepImpl in project Intellij-Plugin by getgauge.
the class ReferenceSearchHelperTest method testShouldFindReferencesOfGaugeElement.
@Test
public void testShouldFindReferencesOfGaugeElement() throws Exception {
SpecStepImpl element = mock(SpecStepImpl.class);
when(element.getProject()).thenReturn(project);
ReferencesSearch.SearchParameters searchParameters = new ReferencesSearch.SearchParameters(element, GlobalSearchScope.allScope(project), true);
when(moduleHelper.isGaugeModule(element)).thenReturn(true);
boolean shouldFindReferences = new ReferenceSearchHelper(moduleHelper).shouldFindReferences(searchParameters, searchParameters.getElementToSearch());
assertTrue("Should find reference for SpecStep(Expected: true, Actual: false)", shouldFindReferences);
}
use of com.thoughtworks.gauge.language.psi.impl.SpecStepImpl in project Intellij-Plugin by getgauge.
the class ConceptReference method resolve.
@Nullable
@Override
public PsiElement resolve() {
SpecStepImpl step = new SpecStepImpl(this.myElement.getNode());
step.setConcept(true);
return StepUtil.findStepImpl(step, moduleForPsiElement(this.myElement));
}
use of com.thoughtworks.gauge.language.psi.impl.SpecStepImpl in project Intellij-Plugin by getgauge.
the class SpecStepsBuilder method build.
public List<PsiElement> build() {
List<PsiElement> specSteps = getPsiElements(SpecStepImpl.class);
Integer count = 0;
for (PsiElement element : specSteps) {
SpecStepImpl specStep = (SpecStepImpl) element;
if (specStep.getInlineTable() != null && TextToTableMap.get(specStep.getInlineTable().getText().trim()) == null) {
tableMap.put("table" + (++count).toString(), specStep.getInlineTable().getText().trim());
TextToTableMap.put(specStep.getInlineTable().getText().trim(), "table" + (count).toString());
}
}
return specSteps;
}
Aggregations