QueueFile implements Closeable, Iterable<byte[]> { public void remove() throws IOException { remove(1); } QueueFile(File file, RandomAccessFile raf, boolean zero, boolean forceLegacy); void add(byte[] data); void add(byte[] data, int offset, int count); boolean isEmpty(); @Nullable byte[] peek(); @Override Iterator<byte[]> iterator(); int size(); void remove(); void remove(int n); void clear(); File file(); @Override void close(); @Override String toString();  }
@Test public void removeFromEmptyFileThrows() throws IOException { QueueFile queue = newQueueFile(); try { queue.remove(); fail("Should have thrown about removing from empty file."); } catch (NoSuchElementException ignored) { } }