Search in sources :

Example 1 with ConceptStepImpl

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;
}
Also used : ConceptStepImpl(com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl)

Example 2 with ConceptStepImpl

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");
}
Also used : ConceptStepImpl(com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl) SpecStepImpl(com.thoughtworks.gauge.language.psi.impl.SpecStepImpl) ASTNode(com.intellij.lang.ASTNode) Test(org.junit.Test)

Example 3 with ConceptStepImpl

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;
}
Also used : ConceptStepImpl(com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl) PsiElement(com.intellij.psi.PsiElement)

Example 4 with ConceptStepImpl

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");
}
Also used : StepValue(com.thoughtworks.gauge.StepValue) ConceptStepImpl(com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl) ReferencesSearch(com.intellij.psi.search.searches.ReferencesSearch) Test(org.junit.Test)

Aggregations

ConceptStepImpl (com.thoughtworks.gauge.language.psi.impl.ConceptStepImpl)4 Test (org.junit.Test)2 ASTNode (com.intellij.lang.ASTNode)1 PsiElement (com.intellij.psi.PsiElement)1 ReferencesSearch (com.intellij.psi.search.searches.ReferencesSearch)1 StepValue (com.thoughtworks.gauge.StepValue)1 SpecStepImpl (com.thoughtworks.gauge.language.psi.impl.SpecStepImpl)1