BinaryAdapters { public static BinaryInject injectionCarrier(ByteBuffer buffer) { return new BinaryInjectAdapter(buffer); } private  BinaryAdapters(); static BinaryExtract extractionCarrier(ByteBuffer buffer); static BinaryInject injectionCarrier(ByteBuffer buffer);  }
@Test public void testInjectBinary() { ByteBuffer buffer = ByteBuffer.allocate(1); BinaryInject binary = BinaryAdapters.injectionCarrier(buffer); assertEquals(buffer, binary.injectionBuffer(1)); assertEquals(0, buffer.position()); }
@Test(expected = IllegalArgumentException.class) public void testInjectBinaryInvalidLength() { BinaryInject binary = BinaryAdapters.injectionCarrier(ByteBuffer.allocate(1)); binary.injectionBuffer(0); }
@Test(expected = AssertionError.class) public void testInjectBinaryLargerLength() { BinaryInject binary = BinaryAdapters.injectionCarrier(ByteBuffer.allocate(1)); binary.injectionBuffer(2); }