Coverage Report - de.jollyday.ManagerParameters
 
Classes in this File Line Coverage Branch Coverage Complexity
ManagerParameters
66%
8/12
75%
3/4
1,25
 
 1  
 package de.jollyday;
 2  
 
 3  
 import java.net.URL;
 4  
 import java.util.Locale;
 5  
 import java.util.Properties;
 6  
 
 7  
 import de.jollyday.parameter.CalendarPartManagerParameter;
 8  
 import de.jollyday.parameter.UrlManagerParameter;
 9  
 
 10  
 public final class ManagerParameters {
 11  
         
 12  0
         private ManagerParameters(){
 13  0
         }
 14  
         
 15  
         public static ManagerParameter create(String calendarPart){
 16  5
                 return create(calendarPart, null);
 17  
         }
 18  
                 
 19  
         public static ManagerParameter create(HolidayCalendar calendar){
 20  3
                 return create(calendar, null);
 21  
         }
 22  
         
 23  
         public static ManagerParameter create(HolidayCalendar calendar, Properties properties){
 24  73
                 return  create(calendar.getId(), properties);
 25  
         }        
 26  
         
 27  
         public static ManagerParameter create(URL calendarFileUrl){
 28  0
                 return create(calendarFileUrl, null);
 29  
         }
 30  
         
 31  
         public static ManagerParameter create(String calendarPart, Properties properties){
 32  1264
                 return  new CalendarPartManagerParameter(prepareCalendarName(calendarPart), properties);
 33  
         }
 34  
 
 35  
         public static ManagerParameter create(URL calendarFileUrl, Properties properties){
 36  0
                 return new UrlManagerParameter(calendarFileUrl, properties);
 37  
         }        
 38  
         
 39  
         private static String prepareCalendarName(String calendar) {
 40  1272
                 if (calendar == null || "".equals(calendar.trim())) {
 41  13
                         calendar = Locale.getDefault().getCountry().toLowerCase();
 42  
                 } else {
 43  1245
                         calendar = calendar.trim().toLowerCase();
 44  
                 }
 45  1256
                 return calendar;
 46  
         }
 47  
         
 48  
 }