@@ -62,6 +62,7 @@ public void testHashcode() {
6262 assertNotEquals (0 , Bytes .wrap (example2_bytes_seven ).hashCode ());
6363 }
6464
65+ @ SuppressWarnings ("SimplifiableJUnitAssertion" )
6566 @ Test
6667 public void testEquals () {
6768 assertTrue (Bytes .wrap (new byte [0 ]).equals (Bytes .wrap (new byte [0 ])));
@@ -150,6 +151,7 @@ public void testIsEmpty() {
150151 assertFalse (Bytes .from (example_bytes_seven ).isEmpty ());
151152 }
152153
154+ @ SuppressWarnings ("SimplifiableJUnitAssertion" )
153155 @ Test
154156 public void containsTest () {
155157 assertEquals (false , Bytes .allocate (0 ).contains ((byte ) 0xFD ));
@@ -372,6 +374,15 @@ public void intAt() {
372374 }
373375 }
374376
377+ @ Test
378+ public void intAtLittleEndian () {
379+ assertEquals (16777216 , Bytes .wrap (new byte []{0 , 0 , 0 , 1 }, ByteOrder .LITTLE_ENDIAN ).intAt (0 ));
380+ assertEquals (1 , Bytes .wrap (new byte []{0 , 0 , 0 , 1 }, ByteOrder .BIG_ENDIAN ).intAt (0 ));
381+ assertEquals (134217728 , Bytes .wrap (new byte []{0 , 0 , 0 , 0b00001000}, ByteOrder .LITTLE_ENDIAN ).intAt (0 ));
382+ assertEquals (524288 , Bytes .wrap (new byte []{0 , 0 , 0b00001000, 0 }, ByteOrder .LITTLE_ENDIAN ).intAt (0 ));
383+ assertEquals (8388608 , Bytes .wrap (new byte []{0 , 0 , (byte ) 0b10000000, 0 }, ByteOrder .LITTLE_ENDIAN ).intAt (0 ));
384+ }
385+
375386 @ Test
376387 public void longAt () {
377388 assertEquals (0 , Bytes .allocate (8 ).longAt (0 ));
@@ -395,6 +406,16 @@ public void longAt() {
395406 }
396407 }
397408
409+ @ Test
410+ public void longAtLittleEndian () {
411+ assertEquals (72057594037927936L , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 }, ByteOrder .LITTLE_ENDIAN ).longAt (0 ));
412+ assertEquals (1 , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 }, ByteOrder .BIG_ENDIAN ).longAt (0 ));
413+ assertEquals (576460752303423488L , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , 0 , 0 , 0 , 0b00001000}, ByteOrder .LITTLE_ENDIAN ).longAt (0 ));
414+ assertEquals (2251799813685248L , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , 0 , 0 , 0b00001000, 0 }, ByteOrder .LITTLE_ENDIAN ).longAt (0 ));
415+ assertEquals (36028797018963968L , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , 0 , 0 , (byte ) 0b10000000, 0 }, ByteOrder .LITTLE_ENDIAN ).longAt (0 ));
416+ assertEquals (549755813888L , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , (byte ) 0b10000000, 0 , 0 , 0 }, ByteOrder .LITTLE_ENDIAN ).longAt (0 ));
417+ }
418+
398419 @ Test
399420 public void primitiveAtLittleEndian () {
400421 assertEquals (576460752303423488L , Bytes .wrap (new byte []{0 , 0 , 0 , 0 , 0 , 0 , 0 , 0b00001000}).byteOrder (ByteOrder .LITTLE_ENDIAN ).longAt (0 )); //2^59
0 commit comments