Win32Buffer extends Buffer { @Override public void put(byte[] src) { if (src.length > getSize()) { throw new BufferOverflowException(); } else if (getAddress() == NULL) { throw new NullPointerException("address is 0"); } put0(getAddress(), src); } Win32Buffer(int size);  Win32Buffer(byte[] address, int size); @Override byte[] get(); @Override void put(byte[] src); @Override Buffer subBuffer(int index, int size);  }
@Test(expected = BufferOverflowException.class) public final void bufferOverflow() { byte[] src = getBytes(4); Buffer buffer = factory.createBuffer(src.length); buffer.put(Hex.decode("1234567890")); }