@@ -49,35 +49,44 @@ public void setup() {
4949 public void byteArrayToByteBuffer () throws Exception {
5050 byte [] bytes = new byte [] { 1 , 2 , 3 };
5151 ByteBuffer convert = this .conversionService .convert (bytes , ByteBuffer .class );
52- assertThat (bytes , not (sameInstance (convert . array () )));
53- assertThat (bytes , equalTo ( convert .array ()));
52+ assertThat (convert . array () , not (sameInstance (bytes )));
53+ assertThat (convert .array (), equalTo ( bytes ));
5454 }
5555
5656 @ Test
5757 public void byteBufferToByteArray () throws Exception {
5858 byte [] bytes = new byte [] { 1 , 2 , 3 };
5959 ByteBuffer byteBuffer = ByteBuffer .wrap (bytes );
6060 byte [] convert = this .conversionService .convert (byteBuffer , byte [].class );
61- assertThat (bytes , not (sameInstance (convert )));
62- assertThat (bytes , equalTo (convert ));
61+ assertThat (convert , not (sameInstance (bytes )));
62+ assertThat (convert , equalTo (bytes ));
6363 }
6464
6565 @ Test
6666 public void byteBufferToOtherType () throws Exception {
6767 byte [] bytes = new byte [] { 1 , 2 , 3 };
6868 ByteBuffer byteBuffer = ByteBuffer .wrap (bytes );
6969 OtherType convert = this .conversionService .convert (byteBuffer , OtherType .class );
70- assertThat (bytes , not (sameInstance (convert . bytes )));
71- assertThat (bytes , equalTo (convert . bytes ));
70+ assertThat (convert . bytes , not (sameInstance (bytes )));
71+ assertThat (convert . bytes , equalTo (bytes ));
7272 }
7373
7474 @ Test
7575 public void otherTypeToByteBuffer () throws Exception {
7676 byte [] bytes = new byte [] { 1 , 2 , 3 };
7777 OtherType otherType = new OtherType (bytes );
7878 ByteBuffer convert = this .conversionService .convert (otherType , ByteBuffer .class );
79- assertThat (bytes , not (sameInstance (convert .array ())));
80- assertThat (bytes , equalTo (convert .array ()));
79+ assertThat (convert .array (), not (sameInstance (bytes )));
80+ assertThat (convert .array (), equalTo (bytes ));
81+ }
82+
83+ @ Test
84+ public void byteBufferToByteBuffer () throws Exception {
85+ byte [] bytes = new byte [] { 1 , 2 , 3 };
86+ ByteBuffer byteBuffer = ByteBuffer .wrap (bytes );
87+ ByteBuffer convert = this .conversionService .convert (byteBuffer , ByteBuffer .class );
88+ assertThat (convert , not (sameInstance (byteBuffer .rewind ())));
89+ assertThat (convert , equalTo (byteBuffer .rewind ()));
8190 }
8291
8392
0 commit comments