当前位置: 首页>>代码示例>>Java>>正文


Java MockHttpOutputMessage.getBodyAsString方法代码示例

本文整理汇总了Java中org.springframework.mock.http.MockHttpOutputMessage.getBodyAsString方法的典型用法代码示例。如果您正苦于以下问题:Java MockHttpOutputMessage.getBodyAsString方法的具体用法?Java MockHttpOutputMessage.getBodyAsString怎么用?Java MockHttpOutputMessage.getBodyAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.mock.http.MockHttpOutputMessage的用法示例。


在下文中一共展示了MockHttpOutputMessage.getBodyAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected <T extends Object> String json(T entity) throws IOException {
       MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
       jsonConverter.write(
       		entity, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
       return mockHttpOutputMessage.getBodyAsString();
   }
 
开发者ID:daflockinger,项目名称:poppynotes,代码行数:8,代码来源:BaseControllerTest.java

示例2: toJson

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
/**
 * Map an object to JSON
 *
 * @param o object to map
 * @return JSON result
 */
protected String toJson(Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    //noinspection unchecked
    mappingJackson2HttpMessageConverter.write(
            o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:resourcepool,项目名称:dashboard,代码行数:14,代码来源:AbstractControllerTest.java

示例3: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected String json(Object o) throws IOException {
       MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
       this.mappingJackson2HttpMessageConverter.write(
               o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
       return mockHttpOutputMessage.getBodyAsString();
   }
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:8,代码来源:AbstractControllerTester.java

示例4: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
protected String json(Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    this.mappingJackson2HttpMessageConverter.write(
            o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);

    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:bulktrade,项目名称:SMSC,代码行数:8,代码来源:AbstractSpringMVCTest.java

示例5: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected String json(Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();

    HttpMessageConverter converter = o instanceof String ? stringHttpMessageConverter : mappingJackson2HttpMessageConverter;
    converter.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:9,代码来源:AbstractControllerTest.java

示例6: writeToTextNoFilter

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@Test
public void writeToTextNoFilter() throws Exception {
	List<EntrezGene> genes = EntrezGene.createDummyData();
	ResponseEnvelope envelope = new ResponseEnvelope(genes);
	Assert.isTrue(textConverter.canWrite(envelope.getClass(), textMediaType));
	MockHttpOutputMessage message = new MockHttpOutputMessage();
	textConverter.write(envelope, textMediaType, message);
	String text = message.getBodyAsString();
	Assert.notNull(text);
	System.out.println(text);
	// TODO
}
 
开发者ID:oncoblocks,项目名称:centromere,代码行数:13,代码来源:HttpMessageConverterTests.java

示例7: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
protected String json(Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    this.mappingJackson2HttpMessageConverter.write(
            o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:ProjectIndoor,项目名称:projectindoorweb,代码行数:7,代码来源:ProjectControllerTest.java

示例8: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected String json(Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    this.mappingJackson2HttpMessageConverter.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:sbouclier,项目名称:java-rest-books,代码行数:7,代码来源:BookControllerTest.java

示例9: jsonify

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected String jsonify(Object objectToJsonify) throws IOException {
    final MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    mappingJackson2HttpMessageConverter.write(objectToJsonify, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:gazbert,项目名称:bxbot-ui-server,代码行数:7,代码来源:AbstractControllerTest.java

示例10: asJsonString

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SneakyThrows
public String asJsonString(Object o) {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    messageConverter.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:tsypuk,项目名称:springrestdoc,代码行数:7,代码来源:TestDataGenerator.java

示例11: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
static public String json(MappingJackson2HttpMessageConverter mapping, Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    mapping.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:Orange-OpenSource,项目名称:fiware-ngsi2-api,代码行数:6,代码来源:Utils.java

示例12: toJsonString

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected String toJsonString(Object obj) throws IOException {
       MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
       this.mappingJackson2HttpMessageConverter.write(obj, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
       return mockHttpOutputMessage.getBodyAsString();
   }
 
开发者ID:Apress,项目名称:pro-spring-boot,代码行数:7,代码来源:SprintBootWebApplicationTests.java

示例13: xml

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
static public String xml(MappingJackson2XmlHttpMessageConverter mapping, Object o) throws IOException {
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    mapping.write(o, MediaType.APPLICATION_XML, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:Orange-OpenSource,项目名称:fiware-ngsi-api,代码行数:6,代码来源:Util.java

示例14: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
protected String json(Object o) throws IOException 
{
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    this.mappingJackson2HttpMessageConverter.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:MUNDO-platform,项目名称:srccode,代码行数:7,代码来源:WfsRestControllerTest.java

示例15: json

import org.springframework.mock.http.MockHttpOutputMessage; //导入方法依赖的package包/类
protected String json(Object o) throws IOException {
    
    MockHttpOutputMessage mockHttpOutputMessage = new MockHttpOutputMessage();
    this.mappingJackson2HttpMessageConverter.write(o, MediaType.APPLICATION_JSON, mockHttpOutputMessage);
    return mockHttpOutputMessage.getBodyAsString();
}
 
开发者ID:MUNDO-platform,项目名称:srccode,代码行数:7,代码来源:WfsApiControllerTest.java


注:本文中的org.springframework.mock.http.MockHttpOutputMessage.getBodyAsString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。