use of com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl in project Intellij-Plugin by getgauge.
the class StepUtil method findStepReference.
private static PsiElement findStepReference(SpecStep step, Module module) {
Collection<PsiMethod> stepMethods = getStepMethods(module);
PsiMethod method = findStepImplementationMethod(stepMethods, step, module);
PsiElement referenceElement;
if (method == null) {
referenceElement = searchConceptsForImpl(step, module);
if (referenceElement != null) {
referenceElement = new ConceptStepImpl(referenceElement.getNode(), true);
}
} else {
referenceElement = method;
}
addReferenceToCache(step, referenceElement, module);
return referenceElement;
}
use of com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl in project Intellij-Plugin by getgauge.
the class StepAnnotatorTest method testShouldAnnotateBlankConceptStep.
@Test
public void testShouldAnnotateBlankConceptStep() throws Exception {
ConceptStepImpl element = mock(ConceptStepImpl.class);
when(helper.isGaugeModule(element)).thenReturn(true);
when(helper.isEmpty(any(SpecStepImpl.class))).thenReturn(true);
when(element.getTextRange()).thenReturn(textRange);
when(element.getNode()).thenReturn(mock(ASTNode.class));
new StepAnnotator(helper).annotate(element, holder);
verify(holder, times(1)).createErrorAnnotation(textRange, "Step should not be blank");
}
use of com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl in project Intellij-Plugin by getgauge.
the class ConceptStepsBuilder method build.
@Override
public List<PsiElement> build() {
List<PsiElement> specSteps = getPsiElements(ConceptStepImpl.class);
Integer count = 0;
for (PsiElement element : specSteps) {
ConceptStepImpl specStep = (ConceptStepImpl) element;
if (specStep.getTable() != null && TextToTableMap.get(specStep.getTable().getText().trim()) == null) {
tableMap.put("table" + (++count).toString(), specStep.getTable().getText().trim());
TextToTableMap.put(specStep.getTable().getText().trim(), "table" + (count).toString());
}
}
return specSteps;
}
use of com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl in project Intellij-Plugin by getgauge.
the class ReferenceSearchHelperTest method testGetReferenceElementsForConceptStep.
@Test
public void testGetReferenceElementsForConceptStep() throws Exception {
ConceptStepImpl element = mock(ConceptStepImpl.class);
when(element.getProject()).thenReturn(project);
StepValue stepValue = new StepValue("# hello", "", new ArrayList<>());
ReferencesSearch.SearchParameters searchParameters = new ReferencesSearch.SearchParameters(element, scope, true);
when(element.getStepValue()).thenReturn(stepValue);
ReferenceSearchHelper referenceSearchHelper = new ReferenceSearchHelper();
referenceSearchHelper.getPsiElements(collector, searchParameters.getElementToSearch());
verify(collector, times(1)).get("hello");
}
Aggregations