// Path: src/main/java/com/raibledesigns/util/ConvertUtil.java
// public final class ConvertUtil {
//     private static final Log log = LogFactory.getLog(ConvertUtil.class);
// 
//     /**
//      * Checkstyle rule: utility classes should not have public constructor
//      */
//     private ConvertUtil() {
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Map object.
//      *
//      * @param rb a given resource bundle
//      * @return Map a populated map
//      */
//     public static Map<String, String> convertBundleToMap(ResourceBundle rb) {
//         Map<String, String> map = new HashMap<String, String>();
// 
//         Enumeration<String> keys = rb.getKeys();
//         while (keys.hasMoreElements()) {
//             String key = keys.nextElement();
//             map.put(key, rb.getString(key));
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Convert a java.util.List of LabelValue objects to a LinkedHashMap.
//      *
//      * @param list the list to convert
//      * @return the populated map with the label as the key
//      */
//     public static Map<String, String> convertListToMap(List<LabelValue> list) {
//         Map<String, String> map = new LinkedHashMap<String, String>();
// 
//         for (LabelValue option : list) {
//             map.put(option.getLabel(), option.getValue());
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Properties object.
//      *
//      * @param rb a given resource bundle
//      * @return Properties a populated properties object
//      */
//     public static Properties convertBundleToProperties(ResourceBundle rb) {
//         Properties props = new Properties();
// 
//         for (Enumeration<String> keys = rb.getKeys(); keys.hasMoreElements();) {
//             String key = keys.nextElement();
//             props.put(key, rb.getString(key));
//         }
// 
//         return props;
//     }
// 
//     /**
//      * Convenience method used by tests to populate an object from a
//      * ResourceBundle
//      *
//      * @param obj an initialized object
//      * @param rb a resource bundle
//      * @return a populated object
//      */
//     public static Object populateObject(Object obj, ResourceBundle rb) {
//         try {
//             Map<String, String> map = convertBundleToMap(rb);
//             BeanUtils.copyProperties(obj, map);
//         } catch (Exception e) {
//             e.printStackTrace();
//             log.error("Exception occurred populating object: " + e.getMessage());
//         }
// 
//         return obj;
//     }
// }


import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raibledesigns.util.ConvertUtil;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
package com.raibledesigns.service.impl;



/**
 * A mock class for testing using Mockito.
 *
 * @author mraible
 */
@RunWith(MockitoJUnitRunner.class)
public abstract class BaseManagerMockTestCase {
    /**
     * A logger
     */
    protected final Log log = LogFactory.getLog(getClass());
    /**
     * The resourceBundle
     */
    protected ResourceBundle rb;

    /**
     * Default constructor will set the ResourceBundle if needed.
     */
    public BaseManagerMockTestCase() {
        // Since a ResourceBundle is not required for each class, just
        // do a simple check to see if one exists
        String className = this.getClass().getName();

        try {
            rb = ResourceBundle.getBundle(className);
        } catch (MissingResourceException mre) {
            //log.debug("No resource bundle found for: " + className);
        }
    }

    /**
     * Utility method to populate a javabean-style object with values
     * from a Properties file
     *
     * @param obj the model object to populate
     * @return Object populated object
     * @throws Exception if BeanUtils fails to copy properly
     */
    protected Object populate(Object obj) throws Exception {
        // loop through all the beans methods and set its properties from
        // its .properties file
// Path: src/main/java/com/raibledesigns/util/ConvertUtil.java
// public final class ConvertUtil {
//     private static final Log log = LogFactory.getLog(ConvertUtil.class);
// 
//     /**
//      * Checkstyle rule: utility classes should not have public constructor
//      */
//     private ConvertUtil() {
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Map object.
//      *
//      * @param rb a given resource bundle
//      * @return Map a populated map
//      */
//     public static Map<String, String> convertBundleToMap(ResourceBundle rb) {
//         Map<String, String> map = new HashMap<String, String>();
// 
//         Enumeration<String> keys = rb.getKeys();
//         while (keys.hasMoreElements()) {
//             String key = keys.nextElement();
//             map.put(key, rb.getString(key));
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Convert a java.util.List of LabelValue objects to a LinkedHashMap.
//      *
//      * @param list the list to convert
//      * @return the populated map with the label as the key
//      */
//     public static Map<String, String> convertListToMap(List<LabelValue> list) {
//         Map<String, String> map = new LinkedHashMap<String, String>();
// 
//         for (LabelValue option : list) {
//             map.put(option.getLabel(), option.getValue());
//         }
// 
//         return map;
//     }
// 
//     /**
//      * Method to convert a ResourceBundle to a Properties object.
//      *
//      * @param rb a given resource bundle
//      * @return Properties a populated properties object
//      */
//     public static Properties convertBundleToProperties(ResourceBundle rb) {
//         Properties props = new Properties();
// 
//         for (Enumeration<String> keys = rb.getKeys(); keys.hasMoreElements();) {
//             String key = keys.nextElement();
//             props.put(key, rb.getString(key));
//         }
// 
//         return props;
//     }
// 
//     /**
//      * Convenience method used by tests to populate an object from a
//      * ResourceBundle
//      *
//      * @param obj an initialized object
//      * @param rb a resource bundle
//      * @return a populated object
//      */
//     public static Object populateObject(Object obj, ResourceBundle rb) {
//         try {
//             Map<String, String> map = convertBundleToMap(rb);
//             BeanUtils.copyProperties(obj, map);
//         } catch (Exception e) {
//             e.printStackTrace();
//             log.error("Exception occurred populating object: " + e.getMessage());
//         }
// 
//         return obj;
//     }
// }


// Path: src/test/java/com/raibledesigns/service/impl/BaseManagerMockTestCase.java
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raibledesigns.util.ConvertUtil;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

package com.raibledesigns.service.impl;



/**
 * A mock class for testing using Mockito.
 *
 * @author mraible
 */
@RunWith(MockitoJUnitRunner.class)
public abstract class BaseManagerMockTestCase {
    /**
     * A logger
     */
    protected final Log log = LogFactory.getLog(getClass());
    /**
     * The resourceBundle
     */
    protected ResourceBundle rb;

    /**
     * Default constructor will set the ResourceBundle if needed.
     */
    public BaseManagerMockTestCase() {
        // Since a ResourceBundle is not required for each class, just
        // do a simple check to see if one exists
        String className = this.getClass().getName();

        try {
            rb = ResourceBundle.getBundle(className);
        } catch (MissingResourceException mre) {
            //log.debug("No resource bundle found for: " + className);
        }
    }

    /**
     * Utility method to populate a javabean-style object with values
     * from a Properties file
     *
     * @param obj the model object to populate
     * @return Object populated object
     * @throws Exception if BeanUtils fails to copy properly
     */
    protected Object populate(Object obj) throws Exception {
        // loop through all the beans methods and set its properties from
        // its .properties file
        Map map = ConvertUtil.convertBundleToMap(rb);