Coverage Report - org.jbehave.core.steps.groovy.GroovyStepsFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
GroovyStepsFactory
100%
9/9
100%
4/4
1.667
 
 1  
 package org.jbehave.core.steps.groovy;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.List;
 5  
 
 6  
 import org.jbehave.core.configuration.Configuration;
 7  
 import org.jbehave.core.configuration.groovy.GroovyContext;
 8  
 import org.jbehave.core.steps.AbstractStepsFactory;
 9  
 
 10  
 public class GroovyStepsFactory extends AbstractStepsFactory {
 11  
 
 12  
     private final GroovyContext context;
 13  
 
 14  
     public GroovyStepsFactory(Configuration configuration, GroovyContext context){
 15  2
         super(configuration);
 16  2
         this.context = context;
 17  2
     }
 18  
 
 19  
     @Override
 20  
     protected List<Class<?>> stepsTypes() {
 21  2
         List<Class<?>> types = new ArrayList<Class<?>>();
 22  2
         for (Object object : context.getInstances() ){
 23  3
             if (hasAnnotatedMethods(object.getClass())) {
 24  2
                 types.add(object.getClass());
 25  
             }
 26  
         }
 27  2
         return types;
 28  
     }
 29  
 
 30  
     public Object createInstanceOfType(Class<?> type) {
 31  1
         return context.getInstanceOfType(type);
 32  
     }
 33  
 
 34  
 }