@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2022 the original author or authors .
* Copyright 2002 - 2023 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -32,11 +32,13 @@ public class ByteArrayHttpMessageConverterTests {
@@ -32,11 +32,13 @@ public class ByteArrayHttpMessageConverterTests {
private ByteArrayHttpMessageConverter converter ;
@BeforeEach
public void setUp ( ) {
converter = new ByteArrayHttpMessageConverter ( ) ;
}
@Test
public void canRead ( ) {
assertThat ( converter . canRead ( byte [ ] . class , new MediaType ( "application" , "octet-stream" ) ) ) . isTrue ( ) ;
@ -73,10 +75,8 @@ public class ByteArrayHttpMessageConverterTests {
@@ -73,10 +75,8 @@ public class ByteArrayHttpMessageConverterTests {
byte [ ] body = new byte [ ] { 0x1 , 0x2 } ;
converter . write ( body , null , outputMessage ) ;
assertThat ( outputMessage . getBodyAsBytes ( ) ) . as ( "Invalid result" ) . isEqualTo ( body ) ;
assertThat ( outputMessage . getHeaders ( ) . getContentType ( ) )
. as ( "Invalid content-type" ) . isEqualTo ( MediaType . APPLICATION_OCTET_STREAM ) ;
assertThat ( outputMessage . getHeaders ( ) . getContentLength ( ) )
. as ( "Invalid content-length" ) . isEqualTo ( 2 ) ;
assertThat ( outputMessage . getHeaders ( ) . getContentType ( ) ) . isEqualTo ( MediaType . APPLICATION_OCTET_STREAM ) ;
assertThat ( outputMessage . getHeaders ( ) . getContentLength ( ) ) . isEqualTo ( 2 ) ;
}
}