/*
 * 文件名称:          ExpertTest.java
 * 版权所有@ 2014-2016 无锡开云信息技术有限公司
 * 编译器:           JDK1.8
 * 时间:             下午4:18:35
 */
package com.ky.tao.demand;

import org.junit.Before;
import org.junit.Test;

import com.ky.tao.base.BaseCallBack;
import com.ky.tao.common.httpclient.KYRequestInfo;
import com.ky.tao.entity.DeleteInfo;
import com.ky.tao.entity.SearchInfo;

/**
 * TODO: 文件注释
 * <p>
 * <p>
 * Version:        V1.0.0
 * <p>
 * 作者:           liangjinjing
 * <p>
 * 日期:           2016年10月29日
 * <p>
 * 负责人:         liangjinjing
 * <p>
 * <p>
 */
public class DemandTest
{
    
    @ Before
    public void init()
    {
        if (callback == null)
        {
            callback = new BaseCallBack(DemandTest.class);
        }
    }

    @ Test
    public void addDemand()
    {
        KYRequestInfo requestInfo = new KYRequestInfo();
        requestInfo.setUrl("http://localhost:8080/demand/add");
        requestInfo.setBodyInfo(new AddDemandInfo());
        callback.doPost(requestInfo, true);
    }
    
    @ Test
    public void updateDemand()
    {
        KYRequestInfo requestInfo = new KYRequestInfo();
        requestInfo.setUrl("http://localhost:8080/demand/update");
        AddDemandInfo addInfo = new AddDemandInfo();
        addInfo.setId(2);
        addInfo.setStatus(3);
        requestInfo.setBodyInfo(addInfo);
        callback.doPost(requestInfo, true);
    }
    
    @ Test
    public void searchDemand()
    {
        KYRequestInfo requestInfo = new KYRequestInfo();
        requestInfo.setUrl("http://localhost:8080/demand/search");
        SearchInfo searchInfo = new SearchInfo();
        searchInfo.setKeyword("小");
        requestInfo.setBodyInfo(searchInfo);
        callback.doPost(requestInfo, true);
    }
    
    @ Test
    public void deleteDemands()
    {
        KYRequestInfo requestInfo = new KYRequestInfo();
        requestInfo.setUrl("http://localhost:8080/demand/delete");
        DeleteInfo deleteInfo = new DeleteInfo();
        deleteInfo.setIds(new long[]{1});
        requestInfo.setBodyInfo(deleteInfo);
        callback.doPost(requestInfo, true);
    }

    
    private BaseCallBack callback;
}
