### Question:
PaymentUtils { public static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString) { if (TextUtils.isEmpty(quantityString)) { return true; } Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9])?"); return pattern.matcher(quantityString).matches(); }  static boolean matchesCurrencyPatternOrEmpty(@Nullable String priceString); static boolean matchesQuantityPatternOrEmpty(@Nullable String quantityString); @NonNull static List<CartError> validateLineItemList(
            List<LineItem> lineItems,
            @NonNull String currencyCode); static CartError searchLineItemForErrors(LineItem lineItem); @NonNull static String getPriceString(long price); @NonNull static List<CartError> removeErrorType(
            @NonNull List<CartError> errors,
            @NonNull @CartError.CartErrorType String errorType); @NonNull static String getPriceString(Long price, @NonNull Currency currency); static IsReadyToPayRequest getStripeIsReadyToPayRequest();  }### Answer:
@Test public void matchesQuantityPattern_whenValid_returnsTrue() { assertTrue(matchesQuantityPatternOrEmpty(null)); assertTrue(matchesQuantityPatternOrEmpty("")); assertTrue(matchesQuantityPatternOrEmpty("10.1")); assertTrue(matchesQuantityPatternOrEmpty("01")); assertTrue(matchesQuantityPatternOrEmpty("500000000000")); assertTrue(matchesQuantityPatternOrEmpty("100")); }
@Test public void matchesQuantityPattern_whenInvalid_returnsFalse() { assertFalse(matchesQuantityPatternOrEmpty("1.23")); assertFalse(matchesQuantityPatternOrEmpty(".99")); assertFalse(matchesQuantityPatternOrEmpty("0.123")); assertFalse(matchesQuantityPatternOrEmpty("1.")); assertFalse(matchesQuantityPatternOrEmpty("-5")); }