### Question:
JSCSIDevice implements Device { public void read(final long address, final byte[] data) throws Exception { if (blockCount == -1) { throw new IllegalStateException("You first have to open the Device!"); } long blocks = data.length / blockSize; if (address < 0 || address + blocks > blockCount) { long adr; if (address < 0) { adr = address; } else { adr = address + blocks - 1; } throw new IllegalArgumentException("Address " + adr + " out of range!"); } if (data.length % blockSize != 0) { throw new IllegalArgumentException("Number of bytes is not a multiple of the blocksize!"); } final ByteBuffer dst = ByteBuffer.allocate(data.length); initiator.read(target, dst, (int)address, data.length); dst.rewind(); dst.get(data); } JSCSIDevice(final String targetName); void close(); int getBlockSize(); String getName(); long getBlockCount(); void open(); void read(final long address, final byte[] data); void write(final long address, final byte[] data);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testReadAddressToLow() throws Exception { address = -1; device.read(address, testData); }
@Test(expected = IllegalArgumentException.class) public void testReadIllegalSize() throws Exception { address = 0; byte[] result = new byte[1]; device.read(address, result); }