@@ -38,6 +38,34 @@ public void testByteArrayToInt() {
3838
3939 Assertions .assertThat (BytesUtils .byteArrayToInt (BytesUtils .fromString ("00000100" ), 2 , 1 )).isEqualTo (1 );
4040
41+ try {
42+ BytesUtils .byteArrayToInt (null );
43+ Assert .fail ();
44+ } catch (Exception e ) {
45+ Assert .assertTrue (true );
46+ }
47+
48+ try {
49+ BytesUtils .byteArrayToInt (null , 2 , 2 );
50+ Assert .fail ();
51+ } catch (Exception e ) {
52+ Assert .assertTrue (true );
53+ }
54+
55+ try {
56+ BytesUtils .byteArrayToInt (tab , 0 , 10 );
57+ Assert .fail ();
58+ } catch (Exception e ) {
59+ Assert .assertTrue (true );
60+ }
61+
62+ try {
63+ BytesUtils .byteArrayToInt (tab , 2 , 3 );
64+ Assert .fail ();
65+ } catch (Exception e ) {
66+ Assert .assertTrue (true );
67+ }
68+
4169 }
4270
4371 /**
@@ -94,6 +122,12 @@ public void testBytesToStringNoSpaceTruncate() {
94122 Assertions .assertThat (BytesUtils .bytesToStringNoSpace (BytesUtils .toByteArray (0 ), true )).isEqualTo ("" );
95123 Assertions .assertThat (BytesUtils .bytesToStringNoSpace (BytesUtils .toByteArray (Integer .MAX_VALUE ), true )).isEqualTo (
96124 "7FFFFFFF" );
125+
126+ Assertions .assertThat (BytesUtils .bytesToString (BytesUtils .toByteArray (4608 ), true )).isEqualTo ("12 00" );
127+ Assertions .assertThat (BytesUtils .bytesToString (BytesUtils .toByteArray (206 ), true )).isEqualTo ("CE" );
128+ Assertions .assertThat (BytesUtils .bytesToString (BytesUtils .toByteArray (266 ), true )).isEqualTo ("01 0A" );
129+ Assertions .assertThat (BytesUtils .bytesToString (BytesUtils .toByteArray (0 ), true )).isEqualTo ("" );
130+ Assertions .assertThat (BytesUtils .bytesToString (BytesUtils .toByteArray (Integer .MAX_VALUE ), true )).isEqualTo ("7F FF FF FF" );
97131 }
98132
99133 @ Test (expected = IllegalAccessException .class )
0 commit comments