@Test(expected = IllegalArgumentException.class) public void removingAnUnknownIdShouldResultInAnException() { cut.remove(OTHER_PENDING_ORDER_ID); }
public void remove(final int id) { final OrderEventListener removed = idToOrder.remove(id); if (removed == null) { throw new IllegalArgumentException("An OrderEventListener with the id " + id + " should be removed from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } }
PendingOrderMapper { public void remove(final int id) { final OrderEventListener removed = idToOrder.remove(id); if (removed == null) { throw new IllegalArgumentException("An OrderEventListener with the id " + id + " should be removed from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } } }
PendingOrderMapper { public void remove(final int id) { final OrderEventListener removed = idToOrder.remove(id); if (removed == null) { throw new IllegalArgumentException("An OrderEventListener with the id " + id + " should be removed from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } }  }
PendingOrderMapper { public void remove(final int id) { final OrderEventListener removed = idToOrder.remove(id); if (removed == null) { throw new IllegalArgumentException("An OrderEventListener with the id " + id + " should be removed from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } }  void put(final int id, final OrderEventListener listener); void remove(final int id); boolean has(final int id); OrderEventListener get(final int orderId); }
PendingOrderMapper { public void remove(final int id) { final OrderEventListener removed = idToOrder.remove(id); if (removed == null) { throw new IllegalArgumentException("An OrderEventListener with the id " + id + " should be removed from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } }  void put(final int id, final OrderEventListener listener); void remove(final int id); boolean has(final int id); OrderEventListener get(final int orderId);  }