5858 * @author Gary Russell
5959 * @author Byungjun You
6060 * @author Kotaro Matsumoto
61- *
61+ * @author Soby Chacko
6262 */
6363class ContentTypeTckTests {
6464
@@ -111,15 +111,15 @@ void pojoToString() {
111111 void pojoToStringOutboundContentTypeBinding () {
112112 ApplicationContext context = new SpringApplicationBuilder (
113113 PojoToStringConfiguration .class ).web (WebApplicationType .NONE ).run (
114- "--spring.cloud.stream.bindings.echo-out -0.contentType=text/plain " ,
114+ "--spring.cloud.stream.bindings.echo-in -0.contentType=application/json " ,
115115 "--spring.jmx.enabled=false" );
116116 InputDestination source = context .getBean (InputDestination .class );
117117 OutputDestination target = context .getBean (OutputDestination .class );
118118 String jsonPayload = "{\" name\" :\" oleg\" }" ;
119119 source .send (new GenericMessage <>(jsonPayload .getBytes ()));
120120 Message <byte []> outputMessage = target .receive ();
121121 assertThat (outputMessage .getHeaders ().get (MessageHeaders .CONTENT_TYPE ))
122- .isEqualTo (MimeTypeUtils .TEXT_PLAIN_VALUE );
122+ .isEqualTo (MimeTypeUtils .APPLICATION_JSON_VALUE );
123123 assertThat (new String (outputMessage .getPayload (), StandardCharsets .UTF_8 ))
124124 .isEqualTo ("oleg" );
125125 }
@@ -173,7 +173,7 @@ void stringToPojoInboundContentTypeBinding() {
173173 void typelessToPojoInboundContentTypeBinding () {
174174 ApplicationContext context = new SpringApplicationBuilder (
175175 TypelessToPojoConfiguration .class ).web (WebApplicationType .NONE ).run (
176- "--spring.cloud.stream.bindings.echo-in-0.contentType=text/plain " ,
176+ "--spring.cloud.stream.bindings.echo-in-0.contentType=application/json " ,
177177 "--spring.jmx.enabled=false" );
178178 InputDestination source = context .getBean (InputDestination .class );
179179 OutputDestination target = context .getBean (OutputDestination .class );
@@ -207,7 +207,7 @@ void typelessToPojoInboundContentTypeBindingJson() {
207207 void typelessMessageToPojoInboundContentTypeBinding () {
208208 ApplicationContext context = new SpringApplicationBuilder (
209209 TypelessMessageToPojoConfiguration .class ).web (WebApplicationType .NONE )
210- .run ("--spring.cloud.stream.bindings.echo-in-0.contentType=text/plain " ,
210+ .run ("--spring.cloud.stream.bindings.echo-in-0.contentType=application/json " ,
211211 "--spring.jmx.enabled=false" );
212212 InputDestination source = context .getBean (InputDestination .class );
213213 OutputDestination target = context .getBean (OutputDestination .class );
@@ -246,7 +246,7 @@ void typelessToPojoWithTextHeaderContentTypeBinding() {
246246 OutputDestination target = context .getBean (OutputDestination .class );
247247 String jsonPayload = "{\" name\" :\" oleg\" }" ;
248248 source .send (MessageBuilder .withPayload (jsonPayload .getBytes ())
249- .setHeader (MessageHeaders .CONTENT_TYPE , MimeType .valueOf ("text/plain " ))
249+ .setHeader (MessageHeaders .CONTENT_TYPE , MimeType .valueOf ("application/json " ))
250250 .build ());
251251 Message <byte []> outputMessage = target .receive ();
252252 assertThat (outputMessage .getHeaders ().get (MessageHeaders .CONTENT_TYPE ))
@@ -303,7 +303,7 @@ void stringToPojoInboundContentTypeHeader() {
303303 String jsonPayload = "{\" name\" :\" oleg\" }" ;
304304 source .send (new GenericMessage <>(jsonPayload .getBytes (),
305305 new MessageHeaders (Collections .singletonMap (MessageHeaders .CONTENT_TYPE ,
306- MimeTypeUtils .TEXT_PLAIN ))));
306+ MimeTypeUtils .APPLICATION_JSON_VALUE ))));
307307 Message <byte []> outputMessage = target .receive ();
308308 assertThat (outputMessage .getHeaders ().get (MessageHeaders .CONTENT_TYPE ))
309309 .isEqualTo (MimeTypeUtils .APPLICATION_JSON_VALUE );
@@ -315,7 +315,7 @@ void stringToPojoInboundContentTypeHeader() {
315315 void byteArrayToPojoInboundContentTypeBinding () {
316316 ApplicationContext context = new SpringApplicationBuilder (
317317 ByteArrayToPojoConfiguration .class ).web (WebApplicationType .NONE ).run (
318- "--spring.cloud.stream.bindings.echo-in-0.contentType=text/plain " ,
318+ "--spring.cloud.stream.bindings.echo-in-0.contentType=application/json " ,
319319 "--spring.jmx.enabled=false" );
320320 InputDestination source = context .getBean (InputDestination .class );
321321 OutputDestination target = context .getBean (OutputDestination .class );
@@ -338,7 +338,7 @@ void byteArrayToPojoInboundContentTypeHeader() {
338338 String jsonPayload = "{\" name\" :\" oleg\" }" ;
339339 source .send (new GenericMessage <>(jsonPayload .getBytes (),
340340 new MessageHeaders (Collections .singletonMap (MessageHeaders .CONTENT_TYPE ,
341- MimeTypeUtils .TEXT_PLAIN ))));
341+ MimeTypeUtils .APPLICATION_JSON ))));
342342 Message <byte []> outputMessage = target .receive ();
343343 assertThat (outputMessage .getHeaders ().get (MessageHeaders .CONTENT_TYPE ))
344344 .isEqualTo (MimeTypeUtils .APPLICATION_JSON_VALUE );
0 commit comments