Package com.sishuok.mvc.client

Source Code of com.sishuok.mvc.client.AbstractClientTest

package com.sishuok.mvc.client;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.web.client.RestTemplate;

/**
* <p>User: Zhang Kaitao
* <p>Date: 13-12-29
* <p>Version: 1.0
*/
public abstract class AbstractClientTest {

    static RestTemplate restTemplate;
    ObjectMapper objectMapper;//JSON
    Jaxb2Marshaller marshaller;//XML
    String baseUri = "http://localhost:8080/users";

    @Before
    public void setUp() throws Exception {
        objectMapper = new ObjectMapper(); //需要添加jackson jar包

        marshaller = new Jaxb2Marshaller(); //需要添加jaxb2实现(如xstream)
        marshaller.setPackagesToScan(new String[]{"com.sishuok"});
        marshaller.afterPropertiesSet();

        restTemplate = new RestTemplate();
    }
}
TOP

Related Classes of com.sishuok.mvc.client.AbstractClientTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.