单元测试代码

来源:互联网 发布:无线直发器淘宝 编辑:程序博客网 时间:2024/04/28 03:55
BaseTest:
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
/**
 * 单元测试 .
 */
@ContextConfiguration(locations = { "classpath*:conf/spring/*-beans.xml" })
public class BaseTest extends AbstractTestNGSpringContextTests {

}

测试类:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.testng.annotations.Test;
import com.alibaba.fastjson.JSON;
import com.hundsun.fstock.biz.trade.BaseTest;
public class AccountDiagTest extends BaseTest {
    @Autowired
    private DiagnoseConfigLogic diagnoseConfigLogic;

    @Test
    public void testDoAccountOpenJob() throws Exception {
        System.err.println(JSON.toJSONString("1111111"));

// 类的转化

String str = "{\"end_date\":20990101,\"exchange_type\":\"2\",\"fund_account\":\"320070129343\",\"hold_days\":1,\"market_value\":24732.0000,\"money_type\":\"0\",\"start_date\":20161123,\"stock_code\":\"000692\",\"stock_type\":\"0\",\"sum_market_value\":24732.0000}";
        FsStockTradeRecord record = JSON.parseObject(str, FsStockTradeRecord.class);

// 调用diagnoseConfigLogic中的方法

    }

}

0 0
原创粉丝点击