### Question:
PaymentUtils { @NonNull public static List<CartError> removeErrorType( @NonNull List<CartError> errors, @NonNull @CartError.CartErrorType String errorType) { List<CartError> filteredErrors = new ArrayList<>(); for (CartError error : errors) { if (errorType.equals(error.getErrorType())) { continue; } filteredErrors.add(error); } return filteredErrors; }  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 removeErrorType_whenListContainsErrorsOfType_returnsListWithoutThoseErrors() { final CartError error1 = new CartError(CartError.DUPLICATE_TAX, "Dupe Tax"); final CartError error2 = new CartError(CartError.LINE_ITEM_CURRENCY, "Bad line item"); final CartError error3 = new CartError(CartError.LINE_ITEM_PRICE, "Bad price on line item"); final CartError error4 = new CartError(CartError.LINE_ITEM_QUANTITY, "Bad quantity"); final CartError error5 = new CartError(CartError.DUPLICATE_TAX, "Dupe Tax"); List<CartError> errorList = new ArrayList<CartError>() {{ add(error1); add(error2); add(error3); add(error4); add(error5); }}; List<CartError> filteredErrorList = PaymentUtils.removeErrorType(errorList, CartError.DUPLICATE_TAX); assertEquals(3, filteredErrorList.size()); assertEquals(CartError.LINE_ITEM_CURRENCY, filteredErrorList.get(0).getErrorType()); assertEquals(CartError.LINE_ITEM_PRICE, filteredErrorList.get(1).getErrorType()); assertEquals(CartError.LINE_ITEM_QUANTITY, filteredErrorList.get(2).getErrorType()); }
@Test public void removeErrorType_whenListHasNoErrorsOfType_returnsOriginalList() { final CartError error1 = new CartError(CartError.DUPLICATE_TAX, "Dupe Tax"); final CartError error2 = new CartError(CartError.CART_CURRENCY, "Bad line item"); List<CartError> errorList = new ArrayList<CartError>() {{ add(error1); add(error2); }}; List<CartError> filteredErrorList = PaymentUtils.removeErrorType(errorList, CartError.LINE_ITEM_CURRENCY); assertEquals(2, filteredErrorList.size()); assertEquals(CartError.DUPLICATE_TAX, filteredErrorList.get(0).getErrorType()); assertEquals(CartError.CART_CURRENCY, filteredErrorList.get(1).getErrorType()); }
@Test public void removeErrorType_onEmptyList_returnsEmptyList() { assertEmpty(PaymentUtils.removeErrorType(new ArrayList<CartError>(), CartError.LINE_ITEM_QUANTITY)); }