DataShareTest.java 2.28 KB
package com.xkl.datashare;

import com.xkl.Constants;
import com.xkl.HttpTools;
import com.xkl.RtnCodeTools;
import org.junit.Assert;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by win7 on 2017/3/19.
 */
public class DataShareTest {
    private static final String DataShare_REPORT_LIST = Constants.URL_PREFIX + "/dataShare/list";
    private static final String DataShare_REPORT_DETAIL = Constants.URL_PREFIX + "/dataShare/detail";

    /**
     * 数据共享-体检报告列表查询接口
     */
    @Test
    public void testDataShareList() {
        Map<String, String> params = new HashMap<String, String>();
        params.put("t", HttpTools.getNow());
        params.put("type", Constants.KEY_ID);
        params.put("sdate", "2017-04-01");
        params.put("edate", "2017-05-01");
        params.put("sign", HttpTools.getSign(params));
        String response = HttpTools.requestByMap(DataShare_REPORT_LIST, "GET", params);
        Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
        System.out.println(response);
    }

    /**
     * 数据共享-体检报告详情查询接口
     */
    @Test
    public void testDataShareDetail() {
        Map<String, String> params = new HashMap<String, String>();
        params.put("report_id", "77");
        params.put("t", HttpTools.getNow());
        params.put("type", Constants.KEY_ID);
        params.put("sign", HttpTools.getSign(params));
        String response = HttpTools.requestByMap(DataShare_REPORT_DETAIL, "GET", params);
        Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
        System.out.println(response);
    }

    /**
     * 数据共享-体检报告详情查询接口(报告所属的公司信息有误)
     */
    @Test
    public void testDataShareDetail_WrongCompany() {
        Map<String, String> params = new HashMap<String, String>();
        params.put("report_id", "119");
        params.put("t", HttpTools.getNow());
        params.put("type", Constants.KEY_ID);
        params.put("sign", HttpTools.getSign(params));
        String response = HttpTools.requestByMap(DataShare_REPORT_DETAIL, "GET", params);
        Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.COMPANY_ERROR));
        System.out.println(response);
    }
}