class LineItemBuilder {

    static boolean isPriceBreakdownConsistent(
            Long unitPrice,
            BigDecimal quantity,
            Long totalPrice) {
        if (unitPrice == null || quantity == null || totalPrice == null) {
            return true;
        }

        BigDecimal expectedPrice = quantity.multiply(BigDecimal.valueOf(unitPrice));
        BigDecimal actualPrice = BigDecimal.valueOf(totalPrice);

        if (expectedPrice.compareTo(BigDecimal.ZERO) == 0) {
            return totalPrice == 0;
        }

        double ratio = actualPrice.divide(
                expectedPrice,
                CONSISTENCY_SCALE,
                BigDecimal.ROUND_HALF_EVEN).doubleValue();

        return Math.abs(ratio - 1.0) < CONSISTENCY_THRESHOLD;
    }

      LineItemBuilder();
      LineItemBuilder(String currencyCode);

}