// Path: src/main/java/org/lmdbjava/ByteArrayProxy.java
// public static final BufferProxy<byte[]> PROXY_BA = new ByteArrayProxy();
// 
// Path: src/main/java/org/lmdbjava/ByteBufferProxy.java
// public static final BufferProxy<ByteBuffer> PROXY_OPTIMAL;
// 
// Path: src/main/java/org/lmdbjava/DirectBufferProxy.java
// public static final BufferProxy<DirectBuffer> PROXY_DB
//     = new DirectBufferProxy();


import static io.netty.buffer.PooledByteBufAllocator.DEFAULT;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.lmdbjava.ByteArrayProxy.PROXY_BA;
import static org.lmdbjava.ByteBufferProxy.PROXY_OPTIMAL;
import static org.lmdbjava.ComparatorTest.ComparatorResult.EQUAL_TO;
import static org.lmdbjava.ComparatorTest.ComparatorResult.GREATER_THAN;
import static org.lmdbjava.ComparatorTest.ComparatorResult.LESS_THAN;
import static org.lmdbjava.ComparatorTest.ComparatorResult.get;
import static org.lmdbjava.DirectBufferProxy.PROXY_DB;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Comparator;
import com.google.common.primitives.SignedBytes;
import com.google.common.primitives.UnsignedBytes;
import io.netty.buffer.ByteBuf;
import org.agrona.DirectBuffer;
import org.agrona.concurrent.UnsafeBuffer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
      o1b = ByteBuffer.wrap(o1);
      o2b = ByteBuffer.wrap(o2);
      final int result3 = PROXY_OPTIMAL.compare(o1b, o2b);

      assertThat(result3, is(result));

      return result;
    }

    private ByteBuffer arrayToBuffer(final byte[] arr, final int bufferCapacity) {
      if (bufferCapacity < arr.length) {
        throw new IllegalArgumentException("bufferCapacity < arr.length");
      }
      final byte[] newArr = Arrays.copyOf(arr, bufferCapacity);
      final ByteBuffer byteBuffer = ByteBuffer.wrap(newArr);
      byteBuffer.limit(arr.length);
      byteBuffer.position(0);
      return byteBuffer;
    }
  }

  /**
   * Tests {@link DirectBufferProxy}.
   */
  private static class DirectBufferRunner implements ComparatorRunner {

    @Override
    public int compare(final byte[] o1, final byte[] o2) {
      final DirectBuffer o1b = new UnsafeBuffer(o1);
      final DirectBuffer o2b = new UnsafeBuffer(o2);
// Path: src/main/java/org/lmdbjava/ByteArrayProxy.java
// public static final BufferProxy<byte[]> PROXY_BA = new ByteArrayProxy();
// 
// Path: src/main/java/org/lmdbjava/ByteBufferProxy.java
// public static final BufferProxy<ByteBuffer> PROXY_OPTIMAL;
// 
// Path: src/main/java/org/lmdbjava/DirectBufferProxy.java
// public static final BufferProxy<DirectBuffer> PROXY_DB
//     = new DirectBufferProxy();


// Path: src/test/java/org/lmdbjava/ComparatorTest.java
import static io.netty.buffer.PooledByteBufAllocator.DEFAULT;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.lmdbjava.ByteArrayProxy.PROXY_BA;
import static org.lmdbjava.ByteBufferProxy.PROXY_OPTIMAL;
import static org.lmdbjava.ComparatorTest.ComparatorResult.EQUAL_TO;
import static org.lmdbjava.ComparatorTest.ComparatorResult.GREATER_THAN;
import static org.lmdbjava.ComparatorTest.ComparatorResult.LESS_THAN;
import static org.lmdbjava.ComparatorTest.ComparatorResult.get;
import static org.lmdbjava.DirectBufferProxy.PROXY_DB;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Comparator;
import com.google.common.primitives.SignedBytes;
import com.google.common.primitives.UnsignedBytes;
import io.netty.buffer.ByteBuf;
import org.agrona.DirectBuffer;
import org.agrona.concurrent.UnsafeBuffer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

      o1b = ByteBuffer.wrap(o1);
      o2b = ByteBuffer.wrap(o2);
      final int result3 = PROXY_OPTIMAL.compare(o1b, o2b);

      assertThat(result3, is(result));

      return result;
    }

    private ByteBuffer arrayToBuffer(final byte[] arr, final int bufferCapacity) {
      if (bufferCapacity < arr.length) {
        throw new IllegalArgumentException("bufferCapacity < arr.length");
      }
      final byte[] newArr = Arrays.copyOf(arr, bufferCapacity);
      final ByteBuffer byteBuffer = ByteBuffer.wrap(newArr);
      byteBuffer.limit(arr.length);
      byteBuffer.position(0);
      return byteBuffer;
    }
  }

  /**
   * Tests {@link DirectBufferProxy}.
   */
  private static class DirectBufferRunner implements ComparatorRunner {

    @Override
    public int compare(final byte[] o1, final byte[] o2) {
      final DirectBuffer o1b = new UnsafeBuffer(o1);
      final DirectBuffer o2b = new UnsafeBuffer(o2);
      return PROXY_DB.compare(o1b, o2b);