// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidParameterClassException.java
// public class InvalidParameterClassException extends InvalidParameterException {
//     public InvalidParameterClassException() {
//     }
// 
//     public InvalidParameterClassException(String message) {
//         super(message);
//     }
// 
//     public InvalidParameterClassException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidParameterClassException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidParameterClassException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/exception/MissingParameterException.java
// public class MissingParameterException extends InvalidParameterException {
//     public MissingParameterException() {
//     }
// 
//     public MissingParameterException(String message) {
//         super(message);
//     }
// 
//     public MissingParameterException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public MissingParameterException(Throwable cause) {
//         super(cause);
//     }
// 
//     public MissingParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/impl/FirstTrueRulesetExecutorImpl.java
// public class FirstTrueRulesetExecutorImpl<T> extends RulesetExecutor<T> {
//     private final List<RuleExecutor<T>> ruleSet;
//     private String name;
// 
//     public FirstTrueRulesetExecutorImpl(String name, List<RuleExecutor<T>> ruleSet) {
//         this.name = name;
//         this.ruleSet = ruleSet;
//     }
// 
//     @Override
//     public T execute(Map<String, Object> parameters) throws InvalidParameterException {
//         T result = null;
//         for (RuleExecutor<T> rule : ruleSet) {
//             Parameter left = rule.getLeftParameter();
//             String leftName = left.getName();
//             Object leftParameter = parameters.get(leftName);
//             validateParameter(leftName, leftParameter, left.getKlasse());
// 
//             Parameter right = rule.getRightParameter();
// 
//             T ruleResponse;
// 
//             if (right.getStaticValue() == null) {
//                 //send both parameters
//                 String rightName = right.getName();
//                 Object rightParameter = parameters.get(rightName);
//                 validateParameter(rightName, rightParameter, right.getKlasse());
// 
//                 ruleResponse = rule.execute(leftParameter, rightParameter);
// 
//             } else {
//                 //send left parameter only
//                 ruleResponse = rule.execute(leftParameter);
//             }
// 
//             // if the rule is true, send its response and stop processing
//             if (null != ruleResponse) {
//                 result = ruleResponse;
//                 break;
//             }
//         }
//         return result;
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
// 
// }


import org.mockito.runners.MockitoJUnitRunner;
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.when;
import org.grouchotools.jsrules.exception.InvalidParameterClassException;
import org.grouchotools.jsrules.exception.MissingParameterException;
import org.grouchotools.jsrules.impl.FirstTrueRulesetExecutorImpl;
import org.junit.*;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
    @Before
    public void setUp() {
        when(ruleExecutorMock1.getLeftParameter()).thenReturn(new Parameter<>(leftName, Long.class));
        when(ruleExecutorMock1.getRightParameter()).thenReturn(new Parameter<>(rightName, Long.class));

        when(ruleExecutorMock2.getLeftParameter()).thenReturn(new Parameter<>(leftName, Long.class));
        when(ruleExecutorMock2.getRightParameter()).thenReturn(new Parameter<>(rightName, Long.class));

        ruleListMock = new ArrayList<>();
        ruleListMock.add(ruleExecutorMock1);
        ruleListMock.add(ruleExecutorMock2);

        executor = new FirstTrueRulesetExecutorImpl<>(rulesetName, ruleListMock);
    }

    @After
    public void tearDown() {
    }

    @Test
    public void executeEmptyRulesetTest() throws Exception {
        ruleListMock.clear();

        Map<String, Object> parameters = new HashMap<>();

        assertNull(executor.execute(parameters));
    }

    @Test
    public void executeRulesetInvalidLeftParameterTest() throws Exception {
// Path: src/main/java/org/grouchotools/jsrules/exception/InvalidParameterClassException.java
// public class InvalidParameterClassException extends InvalidParameterException {
//     public InvalidParameterClassException() {
//     }
// 
//     public InvalidParameterClassException(String message) {
//         super(message);
//     }
// 
//     public InvalidParameterClassException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidParameterClassException(Throwable cause) {
//         super(cause);
//     }
// 
//     public InvalidParameterClassException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/exception/MissingParameterException.java
// public class MissingParameterException extends InvalidParameterException {
//     public MissingParameterException() {
//     }
// 
//     public MissingParameterException(String message) {
//         super(message);
//     }
// 
//     public MissingParameterException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public MissingParameterException(Throwable cause) {
//         super(cause);
//     }
// 
//     public MissingParameterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: src/main/java/org/grouchotools/jsrules/impl/FirstTrueRulesetExecutorImpl.java
// public class FirstTrueRulesetExecutorImpl<T> extends RulesetExecutor<T> {
//     private final List<RuleExecutor<T>> ruleSet;
//     private String name;
// 
//     public FirstTrueRulesetExecutorImpl(String name, List<RuleExecutor<T>> ruleSet) {
//         this.name = name;
//         this.ruleSet = ruleSet;
//     }
// 
//     @Override
//     public T execute(Map<String, Object> parameters) throws InvalidParameterException {
//         T result = null;
//         for (RuleExecutor<T> rule : ruleSet) {
//             Parameter left = rule.getLeftParameter();
//             String leftName = left.getName();
//             Object leftParameter = parameters.get(leftName);
//             validateParameter(leftName, leftParameter, left.getKlasse());
// 
//             Parameter right = rule.getRightParameter();
// 
//             T ruleResponse;
// 
//             if (right.getStaticValue() == null) {
//                 //send both parameters
//                 String rightName = right.getName();
//                 Object rightParameter = parameters.get(rightName);
//                 validateParameter(rightName, rightParameter, right.getKlasse());
// 
//                 ruleResponse = rule.execute(leftParameter, rightParameter);
// 
//             } else {
//                 //send left parameter only
//                 ruleResponse = rule.execute(leftParameter);
//             }
// 
//             // if the rule is true, send its response and stop processing
//             if (null != ruleResponse) {
//                 result = ruleResponse;
//                 break;
//             }
//         }
//         return result;
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
// 
// }


// Path: src/test/java/org/grouchotools/jsrules/FirstTrueRulesetExecutorTest.java
import org.mockito.runners.MockitoJUnitRunner;
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.when;
import org.grouchotools.jsrules.exception.InvalidParameterClassException;
import org.grouchotools.jsrules.exception.MissingParameterException;
import org.grouchotools.jsrules.impl.FirstTrueRulesetExecutorImpl;
import org.junit.*;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;

    @Before
    public void setUp() {
        when(ruleExecutorMock1.getLeftParameter()).thenReturn(new Parameter<>(leftName, Long.class));
        when(ruleExecutorMock1.getRightParameter()).thenReturn(new Parameter<>(rightName, Long.class));

        when(ruleExecutorMock2.getLeftParameter()).thenReturn(new Parameter<>(leftName, Long.class));
        when(ruleExecutorMock2.getRightParameter()).thenReturn(new Parameter<>(rightName, Long.class));

        ruleListMock = new ArrayList<>();
        ruleListMock.add(ruleExecutorMock1);
        ruleListMock.add(ruleExecutorMock2);

        executor = new FirstTrueRulesetExecutorImpl<>(rulesetName, ruleListMock);
    }

    @After
    public void tearDown() {
    }

    @Test
    public void executeEmptyRulesetTest() throws Exception {
        ruleListMock.clear();

        Map<String, Object> parameters = new HashMap<>();

        assertNull(executor.execute(parameters));
    }

    @Test
    public void executeRulesetInvalidLeftParameterTest() throws Exception {
        exception.expect(InvalidParameterClassException.class);