Ejemplo n.º 1
0
  // Long tests
  @Test
  public void testGetAndSetLong() throws Exception {
    DynamicByteBuffer buf = new DynamicByteBuffer();
    long b1 = -9223372036854775808L;
    long b2 = 9223372036854775807L;
    long b3 = 32768;
    long b4 = 543210987654321L;
    long b5 = 123456789012345L;
    buf.putLong(b1);
    buf.putLong(b2);
    buf.putLong(b3);
    buf.flip();

    assertEquals(b1, buf.getLong());
    assertEquals(b2, buf.getLong());

    buf.rewind();
    buf.putLongAt(0, b4);
    buf.putLongAt(8, b5);
    assertEquals(b4, buf.getLongAt(0));
    assertEquals(b5, buf.getLongAt(8));
  }
Ejemplo n.º 2
0
 @Test(expected = IndexOutOfBoundsException.class)
 public void testGetAndSetPutLongAtException2() {
   DynamicByteBuffer buf = new DynamicByteBuffer();
   buf.putLongAt(129, 121L);
 }