use of cucumber.runtime.snippets.CamelCaseConcatenator in project intellij-plugins by JetBrains.
the class Java8StepDefinitionCreator method buildStepDefinitionByStep.
private static PsiElement buildStepDefinitionByStep(@NotNull final GherkinStep step, Language language) {
final Step cucumberStep = new Step(new ArrayList<>(), step.getKeyword().getText(), step.getStepName(), 0, null, null);
final SnippetGenerator generator = new SnippetGenerator(new Java8Snippet());
final String snippet = generator.getSnippet(cucumberStep, new FunctionNameGenerator(new CamelCaseConcatenator())).replace("PendingException", CucumberJavaUtil.getCucumberPendingExceptionFqn(step)).replaceAll("\\\\\\\\", "\\\\").replaceAll("\\\\d", "\\\\\\\\d");
JVMElementFactory factory = JVMElementFactories.requireFactory(language, step.getProject());
return factory.createExpressionFromText(snippet, step);
}
use of cucumber.runtime.snippets.CamelCaseConcatenator in project intellij-plugins by JetBrains.
the class JavaStepDefinitionCreator method buildStepDefinitionByStep.
private static PsiMethod buildStepDefinitionByStep(@NotNull final GherkinStep step, Language language) {
String annotationPackage = new AnnotationPackageProvider().getAnnotationPackageFor(step);
String methodAnnotation = String.format("@%s.", annotationPackage);
final Step cucumberStep = new Step(new ArrayList<>(), step.getKeyword().getText(), step.getStepName(), 0, null, null);
final SnippetGenerator generator = new SnippetGenerator(new JavaSnippet());
final String snippet = generator.getSnippet(cucumberStep, new FunctionNameGenerator(new CamelCaseConcatenator())).replace("PendingException", CucumberJavaUtil.getCucumberPendingExceptionFqn(step)).replaceFirst("@", methodAnnotation).replaceAll("\\\\\\\\", "\\\\").replaceAll("\\\\d", "\\\\\\\\d");
JVMElementFactory factory = JVMElementFactories.requireFactory(language, step.getProject());
return factory.createMethodFromText(snippet, step);
}
Aggregations