package org.drools.decisiontable.parser;
import java.util.HashMap;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import org.drools.decisiontable.parser.ActionType;
import static org.drools.decisiontable.parser.ActionType.Code;
public class ActionTypeTest {
@Test
public void testChooseActionType() {
Map<Integer, ActionType> actionTypeMap = new HashMap<Integer, ActionType>();
ActionType.addNewActionType( actionTypeMap, "C", 0, 1 );
ActionType type = (ActionType) actionTypeMap.get( new Integer(0) );
assertEquals( Code.CONDITION, type.getCode() );
actionTypeMap = new HashMap<Integer, ActionType>();
ActionType.addNewActionType( actionTypeMap, "A", 0, 1 );
type = (ActionType) actionTypeMap.get( new Integer(0) );
assertEquals(Code.ACTION, type.getCode());
actionTypeMap = new HashMap<Integer, ActionType>();
ActionType.addNewActionType( actionTypeMap, "X", 0, 1 );
type = (ActionType) actionTypeMap.get( new Integer(0) );
assertEquals(Code.ACTIVATIONGROUP, type.getCode());
actionTypeMap = new HashMap<Integer, ActionType>();
ActionType.addNewActionType( actionTypeMap, "ACTIVATION-GROUP", 0, 1 );
type = (ActionType) actionTypeMap.get( new Integer(0) );
assertEquals(Code.ACTIVATIONGROUP, type.getCode());
actionTypeMap = new HashMap<Integer, ActionType>();
ActionType.addNewActionType( actionTypeMap, "NO-LOOP", 0, 1 );
type = (ActionType) actionTypeMap.get( new Integer(0) );
assertEquals(Code.NOLOOP, type.getCode());
actionTypeMap = new HashMap<Integer, ActionType>();
ActionType.addNewActionType( actionTypeMap, "RULEFLOW-GROUP", 0, 1 );
type = (ActionType) actionTypeMap.get( new Integer(0) );
assertEquals(Code.RULEFLOWGROUP, type.getCode());
}
}