Coverage Report - org.jbehave.core.steps.needle.configuration.ReadInjectionProviderClassNames
 
Classes in this File Line Coverage Branch Coverage Complexity
ReadInjectionProviderClassNames
90%
10/11
60%
6/10
6
 
 1  
 package org.jbehave.core.steps.needle.configuration;
 2  
 
 3  
 import java.util.LinkedHashSet;
 4  
 import java.util.ResourceBundle;
 5  
 import java.util.Set;
 6  
 
 7  
 /**
 8  
  * Read ClassNames from properties.
 9  
  * 
 10  
  * @author Jan Galinski, Holisticon AG (jan.galinski@holisticon.de)
 11  
  * @author Simon Zambrovski, Holisticon AG (simon.zambrovski@holisticon.de)
 12  
  */
 13  2
 public enum ReadInjectionProviderClassNames {
 14  
         /**
 15  
          * Singleton Instance
 16  
          */
 17  1
         INSTANCE;
 18  
 
 19  
         private static final String CUSTOM_INJECTION_PROVIDER_CLASSES = "custom.injection.provider.classes";
 20  
 
 21  
         public final Set<String> apply(final ResourceBundle resourceBundle) {
 22  9
                 final LinkedHashSet<String> result = new LinkedHashSet<String>();
 23  
 
 24  9
                 if (resourceBundle != null && resourceBundle.containsKey(CUSTOM_INJECTION_PROVIDER_CLASSES)) {
 25  9
                         final String csvProperty = resourceBundle.getString(CUSTOM_INJECTION_PROVIDER_CLASSES);
 26  18
                         for (final String className : csvProperty.split(",")) {
 27  9
                                 if (className != null) {
 28  9
                                         final String trim = className.trim();
 29  9
                                         if (!"".equals(trim)) {
 30  0
                                                 result.add(trim);
 31  
                                         }
 32  
                                 }
 33  
                         }
 34  
                 }
 35  
 
 36  9
                 return result;
 37  
         }
 38  
 
 39  
 }