### Question:
PreTransactionModel extends BaseStageModel { public void applyDiscountsToBasket(String basketId, List<BasketItem> basketItems, String paymentMethod) { checkNotEmpty(basketId, "Basket id must be set"); checkNotEmpty(basketItems, "Basket items must be set"); checkNotEmpty(paymentMethod, "Payment method must be set"); boolean foundBasket = false; for (Basket basket : transactionRequest.getBaskets()) { if (basket.getId().equals(basketId)) { foundBasket = true; break; } } if (!foundBasket) { throw new IllegalArgumentException("No basket with provided id found in TransactionRequest"); } for (BasketItem basketItem : basketItems) { if (basketItem.getIndividualAmount() >= 0) { throw new IllegalArgumentException("Discount items must all have negative amount values"); } } if (basketItems.size() > 0) { flowResponse.updateBasket(basketId, basketItems); setAmountsPaid(new Amounts(Math.abs(flowResponse.getModifiedBasket().getTotalBasketValue()), transactionRequest.getAmounts().getCurrency()), paymentMethod); } } private  PreTransactionModel(Activity activity, @NonNull TransactionRequest transactionRequest); private  PreTransactionModel(ClientCommunicator clientCommunicator, @NonNull TransactionRequest transactionRequest,
                                InternalData senderInternalData); @NonNull static PreTransactionModel fromActivity(Activity activity); @NonNull static PreTransactionModel fromService(ClientCommunicator clientCommunicator, TransactionRequest request,
                                                  InternalData senderInternalData); @NonNull TransactionRequest getTransactionRequest(); void changeCurrency(String currency, double exchangeRate); void setAdditionalAmount(String identifier, long amount); void setAdditionalAmountAsBaseFraction(String identifier, float fraction); @SafeVarargs final void addRequestData(String key, T... values); void addNewBasket(Basket basket); void applyDiscountsToBasket(String basketId, List<BasketItem> basketItems, String paymentMethod); void setAmountsPaid(Amounts amountsPaid, String paymentMethod); void setPaymentReferences(AdditionalData paymentReferences); void addOrUpdateCustomerDetails(Customer customer); void sendResponse(); void skip(); @Override @NonNull String getRequestJson();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void shouldThrowIllegalArgumentForApplyDiscountsWhenThereAreNoBaskets() throws Exception { transactionRequest.getBaskets().clear(); preTransactionModel.applyDiscountsToBasket("123", new ArrayList<BasketItem>(), ""); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowIllegalArgumentForPositiveBasketItemsWhenApplyingDiscounts() throws Exception { requestBaskets.add(new Basket("basket", new BasketItemBuilder().withLabel("item").withAmount(200).build())); preTransactionModel.applyDiscountsToBasket("123", Arrays.asList(new BasketItemBuilder().withLabel("newItem").withAmount(200).build()), ""); }