Coverage Report - org.codeforamerica.open311.facade.EndpointType
 
Classes in this File Line Coverage Branch Coverage Complexity
EndpointType
100%
10/10
100%
6/6
7
 
 1  
 package org.codeforamerica.open311.facade;
 2  
 
 3  
 /**
 4  
  * Represents the different types of endpoints.
 5  
  * 
 6  
  * @author Santiago MunĂ­n <santimunin@gmail.com>
 7  
  * 
 8  
  */
 9  6
 public enum EndpointType {
 10  1
         PRODUCTION, TEST, ACCEPTATION, UNKNOWN;
 11  
 
 12  
         /**
 13  
          * Builds an instance from a string.
 14  
          * 
 15  
          * @param type
 16  
          *            String representing a type.
 17  
          * @return <code>null</code> if the given type isn't recognized.
 18  
          */
 19  
         public static EndpointType getFromString(String type) {
 20  28
                 type = type.toLowerCase();
 21  28
                 if (type.equals("production")) {
 22  13
                         return PRODUCTION;
 23  
                 }
 24  15
                 if (type.equals("test")) {
 25  13
                         return TEST;
 26  
                 }
 27  2
                 if (type.equals("acceptation")) {
 28  1
                         return ACCEPTATION;
 29  
                 }
 30  1
                 return null;
 31  
 
 32  
         }
 33  
 }