### Question:
TimeEventQueue implements Iterable<EVENT> { public void add(EVENT event, long eventTimestamp, int eventSize, int partition, OFFSET offset) { SortedSet<OFFSET> offsets = getOffsets(partition); TimeEvent<EVENT, OFFSET> timeEvent = new TimeEvent<>(eventTimestamp, partition, offset, event, eventSize); if (events.add(timeEvent)) { if (!offsets.add(offset)) { events.remove(timeEvent); throw new IllegalArgumentException("Adding different event with the same offset " + offset + ", " + event); } totalSize += eventSize; } } TimeEventQueue(Iterable<Integer> partitions); void add(EVENT event, long eventTimestamp, int eventSize, int partition, OFFSET offset); EVENT first(); boolean isEmpty(); boolean isEmpty(int partition); int size(); long getEventSize(); OFFSET getSmallestOffset(int partition); @Override EventIterator<EVENT, OFFSET> iterator();  }### Answer:
@Test (expected = IllegalArgumentException.class) public void testInvalidPartition() { TimeEventQueue<String, Integer> eventQueue = new TimeEventQueue<>(Collections.singleton(1)); eventQueue.add("test", 1L, 10, 2, 0); }