package quant.rich.emoney;

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

import lombok.extern.slf4j.Slf4j;
import nano.StrategyMarkRequest.StrategyMark_Request;
import nano.StrategyMarkResponse.StrategyMark_Response;
import quant.rich.emoney.client.EmoneyClient;

/**
 * 测试获取策略标记数据。可以用这个做一个 MVP，
 */
@SpringBootTest
@ContextConfiguration(classes = EmoneyAutoApplication.class)
@RunWith(SpringJUnit4ClassRunner.class)
@Slf4j
class EmoneyStrategyMarkTests {

	@Test
	void contextLoads() {
	    EmoneyClient.reloginCheck();
	    StrategyMark_Request request = new StrategyMark_Request();
	    
	    request.setGoodsId(600325);
	    
	    StrategyMark_Response response = EmoneyClient.post(
	            request, StrategyMark_Response.class,
	            9400, null);
	    //JSONObject jo = JSONObject.from(request);
	    ObjectNode jo = new ObjectMapper().valueToTree(response);
	    log.info(jo.toPrettyString());
	    
	}

}
