/*
 * Copyright 2017, Yahoo! Inc. Licensed under the terms of the
 * Apache License 2.0. See LICENSE file at the project root for terms.
 */

package com.yahoo.memory;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import org.testng.annotations.Test;

public class WritableMemoryTest {

  @Test
  public void wrapBigEndian() {
    ByteBuffer bb = ByteBuffer.allocate(64); //big endian
    WritableMemory wmem = WritableMemory.wrap(bb);
    assertTrue(wmem.swapBytes());
    assertEquals(wmem.getResourceOrder(), ByteOrder.BIG_ENDIAN);
  }

  @Test
  public void wrapBigEndian2() {
    ByteBuffer bb = ByteBuffer.allocate(64);
    WritableBuffer wbuf = WritableBuffer.wrap(bb);
    assertTrue(wbuf.swapBytes());
    assertEquals(wbuf.getResourceOrder(), ByteOrder.BIG_ENDIAN);
  }

}

@@ -875,10 +875,285 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void checkGetArray() %7B%0A    byte%5B%5D byteArr = new byte%5B64%5D;%0A    WritableMemory wmem = WritableMemory.wrap(byteArr);%0A    assertTrue(wmem.getArray() == byteArr);%0A    WritableBuffer wbuf = wmem.asWritableBuffer();%0A    assertTrue(wbuf.getArray() == byteArr);%0A  %7D%0A%0A
 %7D%0A

Add unit tests