// Path: src/main/java/org/grouchotools/jsrules/config/ResponseConfig.java
// public class ResponseConfig extends JsonBean implements Config {
//     private String response;
//     private String responseClass;
// 
//     public ResponseConfig() {
// 
//     }
// 
//     public ResponseConfig(String response, String responseClass) {
//          this.response = response;
//          this.responseClass = responseClass;
//     }
// 
//     public String getResponse() {
//         return response;
//     }
// 
//     public void setResponse(String response) {
//         this.response = response;
//     }
// 
//     public String getResponseClass() {
//         return responseClass;
//     }
// 
//     public void setResponseClass(String responseClass) {
//         this.responseClass = responseClass;
//     }
//     
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidConfigException.java
// public class InvalidConfigException extends JsRulesException {
// 
//     public InvalidConfigException() {
//     }
// 
//     public InvalidConfigException(String message) {
//         super(message);
//     }
// 
//     public InvalidConfigException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidConfigException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidConfigException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
//     
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/loader/impl/ResponseLoaderImpl.java
// public class ResponseLoaderImpl<T> implements ResponseLoader<T> {
// 
//     /**
//      *
//      * @param config
//      * @return
//      * @throws org.grouchotools.jsrules.exception.InvalidConfigException
//      */
//     @Override
//     public T load(ResponseConfig config) throws InvalidConfigException {
//         if (config == null || config.getResponseClass() == null) {
//             throw new InvalidConfigException("Response class must not be null");
//         }
//         String responseClassName = config.getResponseClass().toUpperCase();
//         ClassHandler handler;
//         try {
//             handler = ClassHandler.valueOf(responseClassName);
//         } catch (IllegalArgumentException ex) {
//             throw new InvalidConfigException(responseClassName+" is not a supported class", ex);
//         }
//         
//         String responseValue = config.getResponse();
//         T response;
//         try {
//             response = handler.convertString(responseValue);
//         } catch (ClassHandlerException|IllegalArgumentException ex) {
//             throw new InvalidConfigException(responseValue+" is not a valid "+responseClassName, ex);
//         }
//         
//         return response;
//     }
// 
// }


import org.grouchotools.jsrules.config.ResponseConfig;
import org.grouchotools.jsrules.exception.InvalidConfigException;
import org.grouchotools.jsrules.loader.impl.ResponseLoaderImpl;
import org.junit.*;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;
/*
 * The MIT License
 *
 * Copyright 2015 Paul.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.grouchotools.jsrules.loader;



/**
 *
 * @author Paul
 */
public class ResponseLoaderTest {
    @Rule
    public ExpectedException exception= ExpectedException.none();
    
    private final ResponseLoader responseLoader = new ResponseLoaderImpl();
    
    public ResponseLoaderTest() {
    }
    
    @BeforeClass
    public static void setUpClass() {
    }
    
    @AfterClass
    public static void tearDownClass() {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }

    @Test
    public void loadResponseTest() throws Exception {
// Path: src/main/java/org/grouchotools/jsrules/config/ResponseConfig.java
// public class ResponseConfig extends JsonBean implements Config {
//     private String response;
//     private String responseClass;
// 
//     public ResponseConfig() {
// 
//     }
// 
//     public ResponseConfig(String response, String responseClass) {
//          this.response = response;
//          this.responseClass = responseClass;
//     }
// 
//     public String getResponse() {
//         return response;
//     }
// 
//     public void setResponse(String response) {
//         this.response = response;
//     }
// 
//     public String getResponseClass() {
//         return responseClass;
//     }
// 
//     public void setResponseClass(String responseClass) {
//         this.responseClass = responseClass;
//     }
//     
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidConfigException.java
// public class InvalidConfigException extends JsRulesException {
// 
//     public InvalidConfigException() {
//     }
// 
//     public InvalidConfigException(String message) {
//         super(message);
//     }
// 
//     public InvalidConfigException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidConfigException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidConfigException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
//     
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/loader/impl/ResponseLoaderImpl.java
// public class ResponseLoaderImpl<T> implements ResponseLoader<T> {
// 
//     /**
//      *
//      * @param config
//      * @return
//      * @throws org.grouchotools.jsrules.exception.InvalidConfigException
//      */
//     @Override
//     public T load(ResponseConfig config) throws InvalidConfigException {
//         if (config == null || config.getResponseClass() == null) {
//             throw new InvalidConfigException("Response class must not be null");
//         }
//         String responseClassName = config.getResponseClass().toUpperCase();
//         ClassHandler handler;
//         try {
//             handler = ClassHandler.valueOf(responseClassName);
//         } catch (IllegalArgumentException ex) {
//             throw new InvalidConfigException(responseClassName+" is not a supported class", ex);
//         }
//         
//         String responseValue = config.getResponse();
//         T response;
//         try {
//             response = handler.convertString(responseValue);
//         } catch (ClassHandlerException|IllegalArgumentException ex) {
//             throw new InvalidConfigException(responseValue+" is not a valid "+responseClassName, ex);
//         }
//         
//         return response;
//     }
// 
// }


// Path: src/test/java/org/grouchotools/jsrules/loader/ResponseLoaderTest.java
import org.grouchotools.jsrules.config.ResponseConfig;
import org.grouchotools.jsrules.exception.InvalidConfigException;
import org.grouchotools.jsrules.loader.impl.ResponseLoaderImpl;
import org.junit.*;
import org.junit.rules.ExpectedException;
import static org.junit.Assert.assertEquals;

/*
 * The MIT License
 *
 * Copyright 2015 Paul.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.grouchotools.jsrules.loader;



/**
 *
 * @author Paul
 */
public class ResponseLoaderTest {
    @Rule
    public ExpectedException exception= ExpectedException.none();
    
    private final ResponseLoader responseLoader = new ResponseLoaderImpl();
    
    public ResponseLoaderTest() {
    }
    
    @BeforeClass
    public static void setUpClass() {
    }
    
    @AfterClass
    public static void tearDownClass() {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }

    @Test
    public void loadResponseTest() throws Exception {
        ResponseConfig responseConfig = new ResponseConfig("25", "long");