Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor updates in the Java Backend API to improve reusability #257

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public void scan(JavaBackend javaBackend, List<String> gluePaths) {
}
}

private Collection<Class<? extends Annotation>> findCucumberAnnotationClasses() {
public Collection<Class<? extends Annotation>> findCucumberAnnotationClasses() {
return resourceLoader.getAnnotations("cucumber.annotation");
}

private void scan(Class<?> glueCodeClass, Method method, Collection<Class<? extends Annotation>> cucumberAnnotationClasses, JavaBackend javaBackend) {
public void scan(Class<?> glueCodeClass, Method method, Collection<Class<? extends Annotation>> cucumberAnnotationClasses, JavaBackend javaBackend) {
for (Class<? extends Annotation> cucumberAnnotationClass : cucumberAnnotationClasses) {
Annotation annotation = method.getAnnotation(cucumberAnnotationClass);
if (annotation != null && !annotation.annotationType().equals(Order.class)) {
Expand Down
12 changes: 10 additions & 2 deletions java/src/main/java/cucumber/runtime/java/JavaBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ public String getSnippet(Step step) {
return snippetGenerator.getSnippet(step);
}

void addStepDefinition(Annotation annotation, Class<?> glueCodeClass, Method method) {
protected ClasspathResourceLoader getClasspathResourceLoader(){
return classpathResourceLoader;
};

protected ClasspathMethodScanner getClasspathMethodScanner(){
return classpathMethodScanner;
};

protected void addStepDefinition(Annotation annotation, Class<?> glueCodeClass, Method method) {
try {
Method regexpMethod = annotation.getClass().getMethod("value");
String regexpString = (String) regexpMethod.invoke(annotation);
Expand All @@ -96,7 +104,7 @@ void addStepDefinition(Annotation annotation, Class<?> glueCodeClass, Method met
}
}

void addHook(Annotation annotation, Class<?> glueCodeClass, Method method) {
protected void addHook(Annotation annotation, Class<?> glueCodeClass, Method method) {
objectFactory.addClass(glueCodeClass);

Order order = method.getAnnotation(Order.class);
Expand Down