package ModelTest;

import java.util.ArrayList;
import java.util.List;

import org.bench4q.share.models.agent.ParameterModel;
import org.bench4q.share.models.agent.scriptrecord.BehaviorModel;
import org.junit.Test;

import static org.junit.Assert.*;

public class BehaviorBaseModelTest {
	@Test
	public void testUserBehavior() {
		List<ParameterModel> parameterModels = new ArrayList<ParameterModel>();
		ParameterModel param = new ParameterModel();
		param.setKey("url");
		param.setValue("www.baidu.com");
		parameterModels.add(param);
		BehaviorModel behaviorBaseModel = BehaviorModel
				.UserBehaviorBuilder(20, "Put", "http", parameterModels);
		assertEquals(20, behaviorBaseModel.getId());
		assertEquals("Put", behaviorBaseModel.getName());
		assertEquals("http", behaviorBaseModel.getUse());
		assertEquals("USERBEHAVIOR", behaviorBaseModel.getType());
		assertEquals(1, behaviorBaseModel.getParameters().size());
	}

	@Test
	public void testTimerBehavior() {
		List<ParameterModel> params = new ArrayList<ParameterModel>();
		ParameterModel param = new ParameterModel();
		param.setKey("Time");
		param.setValue("209");
		params.add(param);
		BehaviorModel behaviorBaseModel = BehaviorModel
				.TimerBehaviorBuilder(3, "Sleep", "ContantTimer", params);
		assertEquals(3, behaviorBaseModel.getId());
		assertEquals("Sleep", behaviorBaseModel.getName());
		assertEquals("ContantTimer", behaviorBaseModel.getUse());
		assertEquals(1, behaviorBaseModel.getParameters().size());
		assertEquals("TIMERBEHAVIOR", behaviorBaseModel.getType());
	}
}
