### Question:
LineItemBuilder { public LineItem build() { LineItem.Builder androidPayBuilder = LineItem.newBuilder(); androidPayBuilder.setCurrencyCode(mCurrency.getCurrencyCode()).setRole(mRole); if (mTotalPrice != null) { androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } if (mUnitPrice != null) { androidPayBuilder.setUnitPrice(PaymentUtils.getPriceString(mUnitPrice, mCurrency)); } if (mQuantity != null) { if (isWholeNumber(mQuantity)) { androidPayBuilder.setQuantity(mQuantity.toBigInteger().toString()); } else { androidPayBuilder.setQuantity(mQuantity.toString()); } } if (mTotalPrice == null && mQuantity != null && mUnitPrice != null) { mTotalPrice = mQuantity.multiply( BigDecimal.valueOf(mUnitPrice), MathContext.DECIMAL64).longValue(); androidPayBuilder.setTotalPrice(PaymentUtils.getPriceString(mTotalPrice, mCurrency)); } else { if (!isPriceBreakdownConsistent(mUnitPrice, mQuantity, mTotalPrice)) { Log.w(TAG, String.format(Locale.ENGLISH, "Price breakdown of %d * %.1f = %d is off by more than 1 percent", mUnitPrice, mQuantity.floatValue(), mTotalPrice)); } } if (mRole != LineItem.Role.REGULAR) { androidPayBuilder.setRole(mRole); } if (!TextUtils.isEmpty(mDescription)) { androidPayBuilder.setDescription(mDescription); } return androidPayBuilder.build(); } LineItemBuilder();   LineItemBuilder(String currencyCode); LineItemBuilder setCurrencyCode(String currencyCode); LineItemBuilder setUnitPrice(long unitPrice); LineItemBuilder setTotalPrice(long totalPrice); LineItemBuilder setQuantity(BigDecimal quantity); LineItemBuilder setQuantity(double quantity); LineItemBuilder setDescription(String description); LineItemBuilder setRole(int role); LineItem build(); static final Set<Integer> VALID_ROLES; }### Answer:
@Test public void setCurrency_withLowerCaseString_stillSetsCurrency() { LineItemBuilder builder = new LineItemBuilder("eur"); LineItem item = builder.build(); assertEquals("EUR", item.getCurrencyCode()); }
@Test(expected = RuntimeException.class) public void setCurrencyCode_whenInvalid_throwsRuntimeException() { new LineItemBuilder("notacurrency").build(); fail("Can't create a LineItemBuilder with an illegal currency."); }