private List<Dart> completelyNewDarts() {
    Dart firstDart = newDart();
    firstDart.setCiscoSku("Other sku 1");

    Dart secondDart = newDart();
    secondDart.setCiscoSku("Other sku 2");

    return newArrayList(firstDart, secondDart);
  }
  private List<Dart> dartsWithSameVersionWithSameQuantity() {

    Dart firstDart = newDart();

    Dart secondDart = newDart();
    secondDart.setCiscoSku(SECOND_CISCO_SKU);

    return newArrayList(firstDart, secondDart);
  }
  private List<Dart> existingDarts() {

    Dart firstDart = newDart();
    firstDart.setQuantity(1);

    Dart secondDart = newDart();
    secondDart.setCiscoSku(SECOND_CISCO_SKU);

    return newArrayList(firstDart, secondDart);
  }
  private List<Dart> dartsWithNewVersionWithDifferentQuantity() {

    Dart firstDart = newDart();
    firstDart.setVersion(firstDart.getVersion() + 1);
    firstDart.setQuantityInitial(10);

    Dart secondDart = newDart();
    secondDart.setVersion(secondDart.getVersion() + 1);
    secondDart.setCiscoSku(SECOND_CISCO_SKU);

    return newArrayList(firstDart, secondDart);
  }
  @Override
  public double getDiscount(
      Dart selectedDart, Promo promo, Pricelist pricelist, long shippedDateInMillis) {

    if (selectedDart != EMPTY_DART) {
      return selectedDart.getDistiDiscount();
    }

    boolean promoIsValid = promoValidator.isValid(promo, shippedDateInMillis);
    if (promoIsValid) {
      return promo.getDiscount();
    }

    if (pricelist != null) {
      return pricelist.getDiscount();
    }

    logger.debug(NO_PRICE_FOUND_MESSAGE);
    throw new CiscoException(NO_PRICE_FOUND_MESSAGE);
  }
  @Test
  public void quantityIsRecountedCorrectlyWhenDartsWithNewVersionImported() {
    when(dartsExtractor.extract(inputStream))
        .thenReturn(dartsWithNewVersionWithDifferentQuantity());
    when(dartsService.getDartsTable()).thenReturn(dartsToTable(existingDarts()));
    defaultDartsImporter.importDarts(inputStream);

    List<Dart> existingDarts = existingDarts();
    List<Dart> importedDarts = dartsWithNewVersionWithDifferentQuantity();

    Dart firstDart = importedDarts.get(0);
    Dart existingFirstDart = existingDarts.get(0);
    int recountedQuantity =
        existingFirstDart.getQuantity()
            + (firstDart.getQuantityInitial() - existingFirstDart.getQuantityInitial());
    firstDart.setQuantity(recountedQuantity);

    verify(dartsService).update(importedDarts);
    verify(dartsService).saveAll(getEmptyDarts());
  }