diff --git a/lib/jbehave-core-3.5.4.jar b/lib/jbehave-core-3.5.4.jar deleted file mode 100644 index e9bb049..0000000 Binary files a/lib/jbehave-core-3.5.4.jar and /dev/null differ diff --git a/lib/jbehave-core-3.6.jar b/lib/jbehave-core-3.6.jar new file mode 100644 index 0000000..ad796c4 Binary files /dev/null and b/lib/jbehave-core-3.6.jar differ diff --git a/src/com/github/kumaraman21/intellijbehave/resolver/StepDefinitionAnnotationConverter.java b/src/com/github/kumaraman21/intellijbehave/resolver/StepDefinitionAnnotationConverter.java index d39f3ac..ceff21d 100644 --- a/src/com/github/kumaraman21/intellijbehave/resolver/StepDefinitionAnnotationConverter.java +++ b/src/com/github/kumaraman21/intellijbehave/resolver/StepDefinitionAnnotationConverter.java @@ -20,8 +20,10 @@ import com.intellij.psi.PsiLiteral; import org.jbehave.core.annotations.Alias; import org.jbehave.core.annotations.Aliases; +import org.jbehave.core.steps.PatternVariantBuilder; import org.jbehave.core.steps.StepType; +import java.util.List; import java.util.Set; import static com.github.kumaraman21.intellijbehave.utility.StepTypeMappings.ANNOTATION_TO_STEP_TYPE_MAPPING; @@ -37,27 +39,32 @@ public Set convertFrom(PsiAnnotation[] annotations) { for (PsiAnnotation annotation : annotations) { // Given, When, Then - if(ANNOTATION_TO_STEP_TYPE_MAPPING.keySet().contains(annotation.getQualifiedName())) { + if (ANNOTATION_TO_STEP_TYPE_MAPPING.keySet().contains(annotation.getQualifiedName())) { stepType = ANNOTATION_TO_STEP_TYPE_MAPPING.get(annotation.getQualifiedName()); String annotationText = getTextFromValue(annotation.getParameterList().getAttributes()[0].getValue()); - stepDefinitionAnnotations.add(new StepDefinitionAnnotation(stepType, annotationText, annotation)); - } - else if(annotation.getQualifiedName().equals(Alias.class.getName())) { + stepDefinitionAnnotations.addAll(getPatternVariants(stepType, annotationText, annotation)); + } else if (annotation.getQualifiedName().equals(Alias.class.getName())) { String annotationText = getTextFromValue(annotation.getParameterList().getAttributes()[0].getValue()); - stepDefinitionAnnotations.add(new StepDefinitionAnnotation(stepType, annotationText, annotation)); - } - else if(annotation.getQualifiedName().equals(Aliases.class.getName())) { - + stepDefinitionAnnotations.addAll(getPatternVariants(stepType, annotationText, annotation)); + } else if (annotation.getQualifiedName().equals(Aliases.class.getName())) { PsiElement[] values = annotation.getParameterList().getAttributes()[0].getValue().getChildren(); for (PsiElement value : values) { - if(value instanceof PsiLiteral) { + if (value instanceof PsiLiteral) { String annotationText = getTextFromValue(value); - stepDefinitionAnnotations.add(new StepDefinitionAnnotation(stepType, annotationText, annotation)); + stepDefinitionAnnotations.addAll(getPatternVariants(stepType, annotationText, annotation)); } } } } + return stepDefinitionAnnotations; + } + private Set getPatternVariants(StepType stepType, String annotationText, PsiAnnotation annotation) { + Set stepDefinitionAnnotations = newHashSet(); + PatternVariantBuilder b = new PatternVariantBuilder(annotationText); + for (String variant : b.allVariants()) { + stepDefinitionAnnotations.add(new StepDefinitionAnnotation(stepType, variant, annotation)); + } return stepDefinitionAnnotations; }