@Test(expected = IllegalArgumentException.class) public void queriingForUnknownPendingOrderIdsShouldResultInAnException() { cut.get(OTHER_PENDING_ORDER_ID); }
public OrderEventListener get(final int orderId) { final OrderEventListener order = idToOrder.get(orderId); if (order == null) { throw new IllegalArgumentException("An OrderEventListener for the order id " + orderId + " was requested from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } return order; }
PendingOrderMapper { public OrderEventListener get(final int orderId) { final OrderEventListener order = idToOrder.get(orderId); if (order == null) { throw new IllegalArgumentException("An OrderEventListener for the order id " + orderId + " was requested from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } return order; } }
PendingOrderMapper { public OrderEventListener get(final int orderId) { final OrderEventListener order = idToOrder.get(orderId); if (order == null) { throw new IllegalArgumentException("An OrderEventListener for the order id " + orderId + " was requested from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } return order; }  }
PendingOrderMapper { public OrderEventListener get(final int orderId) { final OrderEventListener order = idToOrder.get(orderId); if (order == null) { throw new IllegalArgumentException("An OrderEventListener for the order id " + orderId + " was requested from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } return order; }  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 OrderEventListener get(final int orderId) { final OrderEventListener order = idToOrder.get(orderId); if (order == null) { throw new IllegalArgumentException("An OrderEventListener for the order id " + orderId + " was requested from the " + PendingOrderMapper.class.getSimpleName() + " but no OrderEventListener with this id is known.", new NoSuchElementException()); } return order; }  void put(final int id, final OrderEventListener listener); void remove(final int id); boolean has(final int id); OrderEventListener get(final int orderId);  }