// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidParameterException.java
// public class InvalidParameterException extends JsRulesException {
// 
//     public InvalidParameterException() {
//     }
// 
//     public InvalidParameterException(String message) {
//         super(message);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidParameterException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
//     
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/impl/FirstTrueRulesetListExecutorImpl.java
// public class FirstTrueRulesetListExecutorImpl<T> extends RulesetListExecutor<T> {
//     private final List<RulesetExecutor<T>> rulesetList;
//     private final String name;
// 
//     public FirstTrueRulesetListExecutorImpl(String name, List<RulesetExecutor<T>> rulesetList) {
//         this.name = name;
//         this.rulesetList = rulesetList;
//     }
// 
//     @Override
//     public T execute(Map<String, Object> parameters) throws InvalidParameterException {
//         T result = null;
//         /*
//          execute all the rules until a response is found -- if all are false, 
//          return null
//         */
//         for (RulesetExecutor<T> ruleSet : rulesetList) {
//             T ruleResponse = ruleSet.execute(parameters);
//             if (ruleResponse != null) {
//                 result = ruleResponse;
//                 break;
//             }
//         }
//         return result;
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
// }


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.grouchotools.jsrules.exception.InvalidParameterException;
import org.grouchotools.jsrules.impl.FirstTrueRulesetListExecutorImpl;
import org.junit.*;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
/*
 * 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;




/**
 * @author Paul
 */
@RunWith(MockitoJUnitRunner.class)
public class FirstTrueRulesetListExecutorTest {
    private RulesetExecutor<String> executor;
    private final String responseMock = "mock";
    private final String rulesetName = "mockRuleset";

    @org.junit.Rule
    public ExpectedException exception = ExpectedException.none();

    private List<RulesetExecutor<String>> rulesetListMock;
    private Map<String, Object> parameters;

    @Mock
    private RulesetExecutor<String> rulesetExecutorMock;

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
        rulesetListMock = new ArrayList<>();
        parameters = new HashMap<>();

// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidParameterException.java
// public class InvalidParameterException extends JsRulesException {
// 
//     public InvalidParameterException() {
//     }
// 
//     public InvalidParameterException(String message) {
//         super(message);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidParameterException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
//     
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/impl/FirstTrueRulesetListExecutorImpl.java
// public class FirstTrueRulesetListExecutorImpl<T> extends RulesetListExecutor<T> {
//     private final List<RulesetExecutor<T>> rulesetList;
//     private final String name;
// 
//     public FirstTrueRulesetListExecutorImpl(String name, List<RulesetExecutor<T>> rulesetList) {
//         this.name = name;
//         this.rulesetList = rulesetList;
//     }
// 
//     @Override
//     public T execute(Map<String, Object> parameters) throws InvalidParameterException {
//         T result = null;
//         /*
//          execute all the rules until a response is found -- if all are false, 
//          return null
//         */
//         for (RulesetExecutor<T> ruleSet : rulesetList) {
//             T ruleResponse = ruleSet.execute(parameters);
//             if (ruleResponse != null) {
//                 result = ruleResponse;
//                 break;
//             }
//         }
//         return result;
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
// }


// Path: src/test/java/org/grouchotools/jsrules/FirstTrueRulesetListExecutorTest.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.grouchotools.jsrules.exception.InvalidParameterException;
import org.grouchotools.jsrules.impl.FirstTrueRulesetListExecutorImpl;
import org.junit.*;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

/*
 * 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;




/**
 * @author Paul
 */
@RunWith(MockitoJUnitRunner.class)
public class FirstTrueRulesetListExecutorTest {
    private RulesetExecutor<String> executor;
    private final String responseMock = "mock";
    private final String rulesetName = "mockRuleset";

    @org.junit.Rule
    public ExpectedException exception = ExpectedException.none();

    private List<RulesetExecutor<String>> rulesetListMock;
    private Map<String, Object> parameters;

    @Mock
    private RulesetExecutor<String> rulesetExecutorMock;

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
        rulesetListMock = new ArrayList<>();
        parameters = new HashMap<>();

        executor = new FirstTrueRulesetListExecutorImpl<>(rulesetName, rulesetListMock);