### Question:
Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need to be in the range 1 to 32, it was " + event.length); } size += event.length + 2; poolDigest.update(new byte[]{(byte) source, (byte) event.length}); poolDigest.update(event); } finally { writeLock.unlock(); } }  long size(); void add(int source, byte[] event); byte[] getAndClear();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void shouldFailIfSourceIsLessThanZero() throws Exception { pool.add(-1, "Hello".getBytes()); }
@Test(expected = IllegalArgumentException.class) public void shouldFailIfSourceIsGreaterThan255() throws Exception { pool.add(256, "Hello".getBytes()); }
@Test(expected = IllegalArgumentException.class) public void shouldFailIfEventIsEmpty() throws Exception { pool.add(0, new byte[0]); }
@Test(expected = IllegalArgumentException.class) public void shouldFailIfEventLengthIsGreaterThan32() throws Exception { pool.add(0, new byte[33]); }