### Question:
PaymentFlowServiceInfoBuilder { @NonNull public PaymentFlowServiceInfoBuilder withCanPayAmounts(boolean canPayAmounts, String... paymentMethods) { if (canPayAmounts && (paymentMethods == null || paymentMethods.length == 0)) { throw new IllegalArgumentException("If canPayAmounts flag is set, payment methods must be provided"); } this.canPayAmounts = canPayAmounts; this.paymentMethods = new HashSet<>(Arrays.asList(paymentMethods)); return this; }  @NonNull PaymentFlowServiceInfoBuilder withVendor(String vendor); @NonNull PaymentFlowServiceInfoBuilder withDisplayName(String displayName); @NonNull PaymentFlowServiceInfoBuilder withSupportsAccessibilityMode(boolean supportsAccessibilityMode); @NonNull PaymentFlowServiceInfoBuilder withSupportedFlowTypes(String... flowTypes); @NonNull PaymentFlowServiceInfoBuilder withCustomRequestTypes(String... customRequestTypes); @NonNull PaymentFlowServiceInfoBuilder withSupportedDataKeys(String... supportedDataKeys); @NonNull PaymentFlowServiceInfoBuilder withCanAdjustAmounts(boolean canAdjustAmounts); @NonNull PaymentFlowServiceInfoBuilder withCanPayAmounts(boolean canPayAmounts, String... paymentMethods); @NonNull PaymentFlowServiceInfoBuilder withDefaultCurrency(String defaultCurrency); @NonNull PaymentFlowServiceInfoBuilder withSupportedCurrencies(String... supportedCurrencies); @NonNull PaymentFlowServiceInfoBuilder withAdditionalInfo(String key, T... values); @NonNull PaymentFlowServiceInfoBuilder withAdditionalInfo(AdditionalData additionalInfo); @NonNull AdditionalData getCurrentAdditionalInfo(); @NonNull PaymentFlowServiceInfoBuilder withMerchants(Merchant... merchants); @NonNull PaymentFlowServiceInfoBuilder withManualEntrySupport(boolean manualEntrySupport); @NonNull PaymentFlowServiceInfo build(Context context);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void shouldThrowIllegalArgumentWhenPaymentMethodsNotSet() throws Exception { paymentFlowServiceInfoBuilder.withCanPayAmounts(true, (String[]) null); }