nus-yam/ex-repair huggingface dataset:
Program: 164989
Project: 164989
Buggy source:
/** 
 * This method will check to see if the drawable is null or instance of   {@link android.graphics.drawable.ColorDrawable}(see   {@link android.graphics.drawable.ColorDrawable#setColorFilter(int,android.graphics.PorterDuff.Mode)}, if so it will create one. Otherwise this will see if cloneDrawable is true and clone the drawable.
 * @param cloneDrawable - whether to clone the drawable found
 * @param paint - the paint to initialize the new color drawable with
 * @param drawable - the drawable from an object
 * @return - fully created drawable
 */
public static Drawable getDrawable(boolean cloneDrawable,int paint,Drawable drawable){
  Drawable retDrawable;
  if (drawable == null || drawable instanceof ColorDrawable) {
    retDrawable=new ColorDrawable(paint);
  }
 else   if (cloneDrawable) {
    retDrawable=drawable.getConstantState().newDrawable();
  }
 else {
    retDrawable=drawable;
  }
  return retDrawable;
}

Fixed version (ground truth):
/** 
 * This method will check to see if the drawable is null or instance of   {@link android.graphics.drawable.ColorDrawable}(see   {@link android.graphics.drawable.ColorDrawable#setColorFilter(int,android.graphics.PorterDuff.Mode)}, if so it will create one. Otherwise this will see if cloneDrawable is true and clone the drawable.
 * @param cloneDrawable - whether to clone the drawable found
 * @param paint - the paint to initialize the new color drawable with
 * @param drawable - the drawable from an object
 * @return - fully created drawable
 */
public static Drawable getDrawable(boolean cloneDrawable,int paint,Drawable drawable){
  Drawable retDrawable;
  if (drawable == null || drawable instanceof ColorDrawable) {
    retDrawable=new ColorDrawable(paint);
  }
 else   if (cloneDrawable) {
    retDrawable=drawable.mutate();
  }
 else {
    retDrawable=drawable;
  }
  return retDrawable;
}
Program: 164990
Project: 164990
Buggy source:
public ColorfulGridAdapter(){
  mRandom=new Random(System.currentTimeMillis());
  mPainter=new IconPainter();
}

Fixed version (ground truth):
public ColorfulGridAdapter(){
  mRandom=new Random();
  mPainter=new IconPainter();
}
Program: 164991
Project: 164991
Buggy source:
@Test(timeout=5000) public void changePaymentMethod_startsActivity(){
  BraintreeFragment fragment=getSetupFragment();
  doNothing().when(fragment).startActivityForResult(any(Intent.class),anyInt());
  AndroidPayCardNonce androidPayCardNonce=mock(AndroidPayCardNonce.class);
  when(androidPayCardNonce.getGoogleTransactionId()).thenReturn("String_Node_Str");
  AndroidPay.changePaymentMethod(fragment,androidPayCardNonce);
  ArgumentCaptor<Intent> captor=ArgumentCaptor.forClass(Intent.class);
  verify(fragment).startActivityForResult(captor.capture(),eq(AndroidPay.ANDROID_PAY_REQUEST_CODE));
  Intent intent=captor.getValue();
  assertEquals(AndroidPayActivity.class.getName(),intent.getComponent().getClassName());
  assertEquals(CHANGE_PAYMENT_METHOD,intent.getIntExtra(EXTRA_REQUEST_TYPE,-1));
  assertEquals(WalletConstants.ENVIRONMENT_TEST,intent.getIntExtra(EXTRA_ENVIRONMENT,-1));
  assertEquals("String_Node_Str",intent.getStringExtra(EXTRA_GOOGLE_TRANSACTION_ID));
}

Fixed version (ground truth):
@Test(timeout=5000) public void changePaymentMethod_startsActivity(){
  BraintreeFragment fragment=getSetupFragment();
  doNothing().when(fragment).startActivityForResult(any(Intent.class),anyInt());
  AndroidPayCardNonce androidPayCardNonce=mock(AndroidPayCardNonce.class);
  when(androidPayCardNonce.getGoogleTransactionId()).thenReturn("String_Node_Str");
  Cart cart=Cart.newBuilder().build();
  when(androidPayCardNonce.getCart()).thenReturn(cart);
  AndroidPay.changePaymentMethod(fragment,androidPayCardNonce);
  ArgumentCaptor<Intent> captor=ArgumentCaptor.forClass(Intent.class);
  verify(fragment).startActivityForResult(captor.capture(),eq(AndroidPay.ANDROID_PAY_REQUEST_CODE));
  Intent intent=captor.getValue();
  assertEquals(AndroidPayActivity.class.getName(),intent.getComponent().getClassName());
  assertEquals(CHANGE_PAYMENT_METHOD,intent.getIntExtra(EXTRA_REQUEST_TYPE,-1));
  assertEquals(WalletConstants.ENVIRONMENT_TEST,intent.getIntExtra(EXTRA_ENVIRONMENT,-1));
  assertEquals("String_Node_Str",intent.getStringExtra(EXTRA_GOOGLE_TRANSACTION_ID));
  assertEquals(cart,intent.getParcelableExtra(EXTRA_CART));
}
Program: 164992
Project: 164992
Buggy source:
static void onActivityResult(BraintreeFragment fragment,int resultCode,Intent data){
  if (resultCode == Activity.RESULT_OK) {
    if (data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) {
      fragment.sendAnalyticsEvent("String_Node_Str");
      tokenize(fragment,(FullWallet)data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET));
    }
  }
 else   if (resultCode == Activity.RESULT_CANCELED) {
    fragment.sendAnalyticsEvent("String_Node_Str");
  }
 else {
    if (data != null) {
      if (data.hasExtra(EXTRA_ERROR)) {
        fragment.postCallback(new AndroidPayException(data.getStringExtra(EXTRA_ERROR)));
      }
 else {
        fragment.postCallback(new AndroidPayException("String_Node_Str" + data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE,-1) + "String_Node_Str"+ "String_Node_Str"));
      }
    }
    fragment.sendAnalyticsEvent("String_Node_Str");
  }
}

Fixed version (ground truth):
static void onActivityResult(BraintreeFragment fragment,int resultCode,Intent data){
  if (resultCode == Activity.RESULT_OK) {
    if (data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) {
      fragment.sendAnalyticsEvent("String_Node_Str");
      tokenize(fragment,(FullWallet)data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET),(Cart)data.getParcelableExtra(EXTRA_CART));
    }
  }
 else   if (resultCode == Activity.RESULT_CANCELED) {
    fragment.sendAnalyticsEvent("String_Node_Str");
  }
 else {
    if (data != null) {
      if (data.hasExtra(EXTRA_ERROR)) {
        fragment.postCallback(new AndroidPayException(data.getStringExtra(EXTRA_ERROR)));
      }
 else {
        fragment.postCallback(new AndroidPayException("String_Node_Str" + data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE,-1) + "String_Node_Str"+ "String_Node_Str"));
      }
    }
    fragment.sendAnalyticsEvent("String_Node_Str");
  }
}
Program: 164993
Project: 164993
Buggy source:
@Override public void onConfigurationFetched(Configuration configuration){
  fragment.sendAnalyticsEvent("String_Node_Str");
  Intent intent=new Intent(fragment.getApplicationContext(),AndroidPayActivity.class).putExtra(EXTRA_ENVIRONMENT,getEnvironment(configuration.getAndroidPay())).putExtra(EXTRA_GOOGLE_TRANSACTION_ID,androidPayCardNonce.getGoogleTransactionId()).putExtra(EXTRA_REQUEST_TYPE,CHANGE_PAYMENT_METHOD);
  fragment.startActivityForResult(intent,ANDROID_PAY_REQUEST_CODE);
}

Fixed version (ground truth):
@Override public void onConfigurationFetched(Configuration configuration){
  fragment.sendAnalyticsEvent("String_Node_Str");
  Intent intent=new Intent(fragment.getApplicationContext(),AndroidPayActivity.class).putExtra(EXTRA_ENVIRONMENT,getEnvironment(configuration.getAndroidPay())).putExtra(EXTRA_GOOGLE_TRANSACTION_ID,androidPayCardNonce.getGoogleTransactionId()).putExtra(EXTRA_CART,androidPayCardNonce.getCart()).putExtra(EXTRA_REQUEST_TYPE,CHANGE_PAYMENT_METHOD);
  fragment.startActivityForResult(intent,ANDROID_PAY_REQUEST_CODE);
}
Program: 164994
Project: 164994
Buggy source:
/** 
 * Call this method when you've received a successful FullWallet request in your activity's  {@link Activity#onActivityResult(int,int,Intent)} to get an {@link AndroidPayCardNonce} from a{@link FullWallet}.
 * @param fragment An instance of {@link BraintreeFragment}.
 * @param wallet a {@link FullWallet} from the Intent in{@link Activity#onActivityResult(int,int,Intent)}
 */
public static void tokenize(BraintreeFragment fragment,FullWallet wallet){
  try {
    fragment.postCallback(AndroidPayCardNonce.fromFullWallet(wallet));
    fragment.sendAnalyticsEvent("String_Node_Str");
  }
 catch (  JSONException e) {
    fragment.sendAnalyticsEvent("String_Node_Str");
    try {
      fragment.postCallback(ErrorWithResponse.fromJson(wallet.getPaymentMethodToken().getToken()));
    }
 catch (    JSONException e1) {
      fragment.postCallback(e1);
    }
  }
}

Fixed version (ground truth):
/** 
 * Call this method when you've received a successful FullWallet request in your activity's  {@link Activity#onActivityResult(int,int,Intent)} to get an {@link AndroidPayCardNonce} from a{@link FullWallet}.
 * @param fragment An instance of {@link BraintreeFragment}.
 * @param wallet a {@link FullWallet} from the Intent in {@link Activity#onActivityResult(int,int,Intent)}.
 * @param cart the {@link Cart} used when creating the {@link FullWallet}.
 */
public static void tokenize(BraintreeFragment fragment,FullWallet wallet,Cart cart){
  try {
    fragment.postCallback(AndroidPayCardNonce.fromFullWallet(wallet,cart));
    fragment.sendAnalyticsEvent("String_Node_Str");
  }
 catch (  JSONException e) {
    fragment.sendAnalyticsEvent("String_Node_Str");
    try {
      fragment.postCallback(ErrorWithResponse.fromJson(wallet.getPaymentMethodToken().getToken()));
    }
 catch (    JSONException e1) {
      fragment.postCallback(e1);
    }
  }
}
Program: 164995
Project: 164995
Buggy source:
/** 
 * Performs a change masked wallet request. This will allow the user to change the backing card and other information associated with the payment method.
 * @param fragment The current {@link BraintreeFragment}.
 * @param androidPayCardNonce the {@link AndroidPayCardNonce} to update.
 */
public static void changePaymentMethod(final BraintreeFragment fragment,final AndroidPayCardNonce androidPayCardNonce){
  fragment.waitForConfiguration(new ConfigurationListener(){
    @Override public void onConfigurationFetched(    Configuration configuration){
      fragment.sendAnalyticsEvent("String_Node_Str");
      Intent intent=new Intent(fragment.getApplicationContext(),AndroidPayActivity.class).putExtra(EXTRA_ENVIRONMENT,getEnvironment(configuration.getAndroidPay())).putExtra(EXTRA_GOOGLE_TRANSACTION_ID,androidPayCardNonce.getGoogleTransactionId()).putExtra(EXTRA_REQUEST_TYPE,CHANGE_PAYMENT_METHOD);
      fragment.startActivityForResult(intent,ANDROID_PAY_REQUEST_CODE);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Performs a change masked wallet request. This will allow the user to change the backing card and other information associated with the payment method.
 * @param fragment The current {@link BraintreeFragment}.
 * @param androidPayCardNonce the {@link AndroidPayCardNonce} to update.
 */
public static void changePaymentMethod(final BraintreeFragment fragment,final AndroidPayCardNonce androidPayCardNonce){
  fragment.waitForConfiguration(new ConfigurationListener(){
    @Override public void onConfigurationFetched(    Configuration configuration){
      fragment.sendAnalyticsEvent("String_Node_Str");
      Intent intent=new Intent(fragment.getApplicationContext(),AndroidPayActivity.class).putExtra(EXTRA_ENVIRONMENT,getEnvironment(configuration.getAndroidPay())).putExtra(EXTRA_GOOGLE_TRANSACTION_ID,androidPayCardNonce.getGoogleTransactionId()).putExtra(EXTRA_CART,androidPayCardNonce.getCart()).putExtra(EXTRA_REQUEST_TYPE,CHANGE_PAYMENT_METHOD);
      fragment.startActivityForResult(intent,ANDROID_PAY_REQUEST_CODE);
    }
  }
);
}
Program: 164996
Project: 164996
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode == Activity.RESULT_OK && (requestCode == AUTHORIZE || requestCode == CHANGE_PAYMENT_METHOD)) {
    String googleTransactionId=((MaskedWallet)data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET)).getGoogleTransactionId();
    loadFullWallet(googleTransactionId);
  }
 else {
    setResult(resultCode,data);
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode == Activity.RESULT_OK && (requestCode == AUTHORIZE || requestCode == CHANGE_PAYMENT_METHOD)) {
    String googleTransactionId=((MaskedWallet)data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET)).getGoogleTransactionId();
    loadFullWallet(googleTransactionId);
  }
 else {
    data.putExtra(EXTRA_CART,getCart());
    setResult(resultCode,data);
    finish();
  }
}
Program: 164997
Project: 164997
Buggy source:
/** 
 * Convert a   {@link FullWallet} to an {@link AndroidPayCardNonce}.
 * @param wallet the {@link FullWallet} from an Android Pay response
 * @return {@link AndroidPayCardNonce}.
 * @throws JSONException when parsing the response fails.
 */
public static AndroidPayCardNonce fromFullWallet(FullWallet wallet) throws JSONException {
  AndroidPayCardNonce androidPayCardNonce=AndroidPayCardNonce.fromJson(wallet.getPaymentMethodToken().getToken());
  androidPayCardNonce.mDescription=wallet.getPaymentDescriptions()[0];
  androidPayCardNonce.mEmail=wallet.getEmail();
  androidPayCardNonce.mBillingAddress=wallet.getBuyerBillingAddress();
  androidPayCardNonce.mShippingAddress=wallet.getBuyerShippingAddress();
  androidPayCardNonce.mGoogleTransactionId=wallet.getGoogleTransactionId();
  return androidPayCardNonce;
}

Fixed version (ground truth):
/** 
 * Convert a   {@link FullWallet} to an {@link AndroidPayCardNonce}.
 * @param wallet the {@link FullWallet} from an Android Pay response.
 * @param cart the {@link Cart} used to create the {@link FullWallet}.
 * @return {@link AndroidPayCardNonce}.
 * @throws JSONException when parsing the response fails.
 */
public static AndroidPayCardNonce fromFullWallet(FullWallet wallet,Cart cart) throws JSONException {
  AndroidPayCardNonce androidPayCardNonce=AndroidPayCardNonce.fromJson(wallet.getPaymentMethodToken().getToken());
  androidPayCardNonce.mDescription=wallet.getPaymentDescriptions()[0];
  androidPayCardNonce.mEmail=wallet.getEmail();
  androidPayCardNonce.mBillingAddress=wallet.getBuyerBillingAddress();
  androidPayCardNonce.mShippingAddress=wallet.getBuyerShippingAddress();
  androidPayCardNonce.mGoogleTransactionId=wallet.getGoogleTransactionId();
  androidPayCardNonce.mCart=cart;
  return androidPayCardNonce;
}
Program: 164998
Project: 164998
Buggy source:
private AndroidPayCardNonce(Parcel in){
  super(in);
  mCardType=in.readString();
  mLastTwo=in.readString();
  mEmail=in.readString();
  mBillingAddress=in.readParcelable(UserAddress.class.getClassLoader());
  mShippingAddress=in.readParcelable(UserAddress.class.getClassLoader());
  mGoogleTransactionId=in.readString();
}

Fixed version (ground truth):
private AndroidPayCardNonce(Parcel in){
  super(in);
  mCardType=in.readString();
  mLastTwo=in.readString();
  mEmail=in.readString();
  mBillingAddress=in.readParcelable(UserAddress.class.getClassLoader());
  mShippingAddress=in.readParcelable(UserAddress.class.getClassLoader());
  mGoogleTransactionId=in.readString();
  mCart=in.readParcelable(Cart.class.getClassLoader());
}
Program: 164999
Project: 164999
Buggy source:
@Override public void writeToParcel(Parcel dest,int flags){
  super.writeToParcel(dest,flags);
  dest.writeString(mCardType);
  dest.writeString(mLastTwo);
  dest.writeString(mEmail);
  dest.writeParcelable(mBillingAddress,flags);
  dest.writeParcelable(mShippingAddress,flags);
  dest.writeString(mGoogleTransactionId);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel dest,int flags){
  super.writeToParcel(dest,flags);
  dest.writeString(mCardType);
  dest.writeString(mLastTwo);
  dest.writeString(mEmail);
  dest.writeParcelable(mBillingAddress,flags);
  dest.writeParcelable(mShippingAddress,flags);
  dest.writeString(mGoogleTransactionId);
  dest.writeParcelable(mCart,flags);
}
Program: 165001
Project: 165001
Buggy source:
private DropInRequest getDropInRequest(){
  DropInRequest paymentRequest=new DropInRequest().clientToken(mAuthorization).collectDeviceData(Settings.shouldCollectDeviceData(this)).androidPayCart(getAndroidPayCart()).androidPayShippingAddressRequired(Settings.isAndroidPayShippingAddressRequired(this)).androidPayPhoneNumberRequired(Settings.isAndroidPayPhoneNumberRequired(this)).androidPayAllowedCountriesForShipping(Settings.getAndroidPayAllowedCountriesForShipping(this));
  if (Settings.isPayPalAddressScopeRequested(this)) {
    paymentRequest.paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS));
  }
  return paymentRequest;
}

Fixed version (ground truth):
private DropInRequest getDropInRequest(){
  DropInRequest dropInRequest=new DropInRequest().clientToken(mAuthorization).collectDeviceData(Settings.shouldCollectDeviceData(this)).androidPayCart(getAndroidPayCart()).androidPayShippingAddressRequired(Settings.isAndroidPayShippingAddressRequired(this)).androidPayPhoneNumberRequired(Settings.isAndroidPayPhoneNumberRequired(this)).androidPayAllowedCountriesForShipping(Settings.getAndroidPayAllowedCountriesForShipping(this));
  if (Settings.isPayPalAddressScopeRequested(this)) {
    dropInRequest.paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS));
  }
  return dropInRequest;
}
Program: 165002
Project: 165002
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  safelyCloseLoadingView();
  if (resultCode == RESULT_OK) {
    if (requestCode == DROP_IN_REQUEST) {
      DropInResult result=data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
      displayResult(result.getPaymentMethodNonce(),result.getDeviceData());
    }
 else     if (requestCode == CUSTOM_REQUEST || requestCode == PAYPAL_REQUEST) {
      displayResult((PaymentMethodNonce)data.getParcelableExtra(EXTRA_PAYMENT_METHOD_NONCE),data.getStringExtra(EXTRA_DEVICE_DATA));
    }
    if (mNonce instanceof CardNonce && Settings.isThreeDSecureEnabled(this)) {
      mLoading=ProgressDialog.show(this,getString(R.string.loading),getString(R.string.loading),true,false);
      ThreeDSecure.performVerification(mBraintreeFragment,mNonce.getNonce(),"String_Node_Str");
    }
 else {
      mCreateTransactionButton.setEnabled(true);
    }
  }
 else   if (resultCode != RESULT_CANCELED) {
    safelyCloseLoadingView();
    showDialog(((Exception)data.getParcelableExtra(DropInActivity.EXTRA_ERROR)).getMessage());
  }
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  safelyCloseLoadingView();
  if (resultCode == RESULT_OK) {
    if (requestCode == DROP_IN_REQUEST) {
      DropInResult result=data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
      displayResult(result.getPaymentMethodNonce(),result.getDeviceData());
    }
 else     if (requestCode == CUSTOM_REQUEST || requestCode == PAYPAL_REQUEST) {
      displayResult((PaymentMethodNonce)data.getParcelableExtra(EXTRA_PAYMENT_METHOD_NONCE),data.getStringExtra(EXTRA_DEVICE_DATA));
    }
    if (mNonce instanceof CardNonce && Settings.isThreeDSecureEnabled(this)) {
      mLoading=ProgressDialog.show(this,getString(R.string.loading),getString(R.string.loading),true,false);
      ThreeDSecure.performVerification(mBraintreeFragment,mNonce.getNonce(),"String_Node_Str");
    }
 else {
      mCreateTransactionButton.setEnabled(true);
    }
  }
 else   if (resultCode != RESULT_CANCELED) {
    safelyCloseLoadingView();
    showDialog(((Exception)data.getSerializableExtra(DropInActivity.EXTRA_ERROR)).getMessage());
  }
}
Program: 165003
Project: 165003
Buggy source:
@Test public void onStop_flushesAnalyticsEvents() throws JSONException, InvalidArgumentException {
  String configuration=new TestConfigurationStringBuilder().analytics("String_Node_Str").build();
  mockConfigurationManager(Configuration.fromJson(configuration));
  Robolectric.getForegroundThreadScheduler().pause();
  Context context=spy(RuntimeEnvironment.application);
  when(mActivity.getApplicationContext()).thenReturn(context);
  BraintreeFragment fragment=BraintreeFragment.newInstance(mActivity,TOKENIZATION_KEY);
  Robolectric.getForegroundThreadScheduler().unPause();
  Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
  fragment.onStop();
  ArgumentCaptor<Intent> intentCaptor=ArgumentCaptor.forClass(Intent.class);
  verify(context).startService(intentCaptor.capture());
  Intent serviceIntent=intentCaptor.getValue();
  assertEquals(TOKENIZATION_KEY,serviceIntent.getStringExtra(AnalyticsIntentService.EXTRA_AUTHORIZATION));
  assertEquals(configuration,serviceIntent.getStringExtra(AnalyticsIntentService.EXTRA_CONFIGURATION));
}

Fixed version (ground truth):
@Test public void onStop_flushesAnalyticsEvents() throws JSONException, InvalidArgumentException {
  String configuration=new TestConfigurationStringBuilder().analytics("String_Node_Str").build();
  mockConfigurationManager(Configuration.fromJson(configuration));
  Robolectric.getForegroundThreadScheduler().pause();
  Context context=Mockito.spy(RuntimeEnvironment.application);
  when(mActivity.getApplicationContext()).thenReturn(context);
  BraintreeFragment fragment=BraintreeFragment.newInstance(mActivity,TOKENIZATION_KEY);
  Robolectric.getForegroundThreadScheduler().unPause();
  Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
  fragment.onStop();
  ArgumentCaptor<Intent> intentCaptor=ArgumentCaptor.forClass(Intent.class);
  verify(context).startService(intentCaptor.capture());
  Intent serviceIntent=intentCaptor.getValue();
  assertEquals(TOKENIZATION_KEY,serviceIntent.getStringExtra(AnalyticsIntentService.EXTRA_AUTHORIZATION));
  assertEquals(configuration,serviceIntent.getStringExtra(AnalyticsIntentService.EXTRA_CONFIGURATION));
}
Program: 165004
Project: 165004
Buggy source:
@Test(timeout=1000) public void showsPayPalAndVenmo() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,true,false);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),false);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void showsPayPalAndVenmo() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,true,false);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),false);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}
Program: 165005
Project: 165005
Buggy source:
@Test(timeout=1000) public void startsPayWithVenmo() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,true,false);
  Context mockContextForVenmo=new MockContextForVenmo().venmoInstalled().build();
  when(fragment.getApplicationContext()).thenReturn(mockContextForVenmo);
  SignatureVerificationTestUtils.disableSignatureVerification();
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),true);
  clickButton(R.id.bt_venmo_button);
  verify(fragment).sendAnalyticsEvent("String_Node_Str");
}

Fixed version (ground truth):
@Test(timeout=1000) public void startsPayWithVenmo() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,true,false);
  Context mockContextForVenmo=new MockContextForVenmo().venmoInstalled().build();
  when(fragment.getApplicationContext()).thenReturn(mockContextForVenmo);
  SignatureVerificationTestUtils.disableSignatureVerification();
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),true);
  clickButton(com.braintreepayments.api.dropin.R.id.bt_venmo_button);
  verify(fragment).sendAnalyticsEvent("String_Node_Str");
}
Program: 165006
Project: 165006
Buggy source:
@Test(timeout=1000) public void onlyShowsAndroidPay() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(false,false,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void onlyShowsAndroidPay() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(false,false,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}
Program: 165007
Project: 165007
Buggy source:
@Test(timeout=1000) public void showsAllMethodsAndDividers() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  getInstrumentation().waitForIdleSync();
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void showsAllMethodsAndDividers() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  getInstrumentation().waitForIdleSync();
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}
Program: 165008
Project: 165008
Buggy source:
@Test(timeout=5000) public void startsPayWithPayPalWithAddressScope() throws InvalidArgumentException, JSONException, InterruptedException {
  Looper.prepare();
  getFragment(true,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS));
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  clickButton(R.id.bt_paypal_button);
  intending(hasAction(equalTo(Intent.ACTION_VIEW))).respondWith(new ActivityResult(0,null));
  intended(allOf(hasAction(equalTo(Intent.ACTION_VIEW)),hasData(hasScheme("String_Node_Str")),hasData(hasHost("String_Node_Str")),hasData(hasPath("String_Node_Str")),hasData(hasParamWithName("String_Node_Str")),hasData(hasScope("String_Node_Str")),hasData(hasParamWithName("String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasExtras(allOf(hasEntry(BraintreeBrowserSwitchActivity.EXTRA_BROWSER_SWITCH,true)))));
}

Fixed version (ground truth):
@Test(timeout=5000) public void startsPayWithPayPalWithAddressScope() throws InvalidArgumentException, JSONException, InterruptedException {
  Looper.prepare();
  getFragment(true,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).paypalAdditionalScopes(Collections.singletonList(PayPal.SCOPE_ADDRESS));
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  clickButton(com.braintreepayments.api.dropin.R.id.bt_paypal_button);
  intending(hasAction(equalTo(Intent.ACTION_VIEW))).respondWith(new ActivityResult(0,null));
  intended(allOf(hasAction(equalTo(Intent.ACTION_VIEW)),hasData(hasScheme("String_Node_Str")),hasData(hasHost("String_Node_Str")),hasData(hasPath("String_Node_Str")),hasData(hasParamWithName("String_Node_Str")),hasData(hasScope("String_Node_Str")),hasData(hasParamWithName("String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasExtras(allOf(hasEntry(BraintreeBrowserSwitchActivity.EXTRA_BROWSER_SWITCH,true)))));
}
Program: 165009
Project: 165009
Buggy source:
@Test(timeout=1000) public void showsLoadingIndicatorWhileWaitingForConfiguration() throws InvalidArgumentException {
  BraintreeFragment fragment=spy(BraintreeFragment.newInstance(mActivity,TOKENIZATION_KEY));
  when(fragment.getConfiguration()).thenReturn(null);
  fragment.mHttpClient=new BraintreeHttpClient(Authorization.fromString(TOKENIZATION_KEY)){
    @Override public void get(    String path,    HttpResponseCallback callback){
    }
  }
;
  getInstrumentation().waitForIdleSync();
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,new PaymentRequest().tokenizationKey(TOKENIZATION_KEY));
  mPaymentButton.mBraintreeFragment=fragment;
  getInstrumentation().waitForIdleSync();
  ViewSwitcher viewSwitcher=(ViewSwitcher)mPaymentButton.getView().findViewById(R.id.bt_payment_method_view_switcher);
  assertEquals(1,viewSwitcher.getDisplayedChild());
}

Fixed version (ground truth):
@Test(timeout=1000) public void showsLoadingIndicatorWhileWaitingForConfiguration() throws InvalidArgumentException {
  BraintreeFragment fragment=spy(BraintreeFragment.newInstance(mActivity,TOKENIZATION_KEY));
  when(fragment.getConfiguration()).thenReturn(null);
  fragment.mHttpClient=new BraintreeHttpClient(Authorization.fromString(TOKENIZATION_KEY)){
    @Override public void get(    String path,    HttpResponseCallback callback){
    }
  }
;
  getInstrumentation().waitForIdleSync();
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,new PaymentRequest().tokenizationKey(TOKENIZATION_KEY));
  mPaymentButton.mBraintreeFragment=fragment;
  getInstrumentation().waitForIdleSync();
  ViewSwitcher viewSwitcher=(ViewSwitcher)mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_method_view_switcher);
  assertEquals(1,viewSwitcher.getDisplayedChild());
}
Program: 165010
Project: 165010
Buggy source:
@Test(timeout=1000) public void showsPayPalAndAndroidPay() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,false,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void showsPayPalAndAndroidPay() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(true,false,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}
Program: 165011
Project: 165011
Buggy source:
@Test(timeout=1000) public void showsVenmoAndAndroidPay() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(false,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void showsVenmoAndAndroidPay() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(false,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),true);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}
Program: 165012
Project: 165012
Buggy source:
@Test(timeout=5000) public void startsPayWithAndroidPay() throws JSONException, InvalidArgumentException, InterruptedException {
  Looper.prepare();
  BraintreeFragment fragment=getFragment(true,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),true);
  clickButton(R.id.bt_android_pay_button);
  verify(fragment).sendAnalyticsEvent("String_Node_Str");
}

Fixed version (ground truth):
@Test(timeout=5000) public void startsPayWithAndroidPay() throws JSONException, InvalidArgumentException, InterruptedException {
  Looper.prepare();
  BraintreeFragment fragment=getFragment(true,true,true);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY).androidPayCart(Cart.newBuilder().build());
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),true);
  clickButton(com.braintreepayments.api.dropin.R.id.bt_android_pay_button);
  verify(fragment).sendAnalyticsEvent("String_Node_Str");
}
Program: 165013
Project: 165013
Buggy source:
@Test(timeout=1000) public void onlyShowsVenmo() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(false,true,false);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),false);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void onlyShowsVenmo() throws InvalidArgumentException, JSONException, InterruptedException {
  BraintreeFragment fragment=getFragment(false,true,false);
  PaymentRequest paymentRequest=new PaymentRequest().tokenizationKey(TOKENIZATION_KEY);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,paymentRequest);
  getInstrumentation().waitForIdleSync();
  mPaymentButton.mBraintreeFragment=fragment;
  setupPaymentButton(fragment.getConfiguration(),false);
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}
Program: 165014
Project: 165014
Buggy source:
@Test(timeout=5000) public void startsPayWithPayPal() throws InvalidArgumentException, JSONException, InterruptedException {
  Looper.prepare();
  getFragment(true,true,true);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,new PaymentRequest().tokenizationKey(TOKENIZATION_KEY));
  getInstrumentation().waitForIdleSync();
  clickButton(R.id.bt_paypal_button);
  intending(hasAction(equalTo(Intent.ACTION_VIEW))).respondWith(new ActivityResult(0,null));
  intended(allOf(hasAction(equalTo(Intent.ACTION_VIEW)),hasData(hasScheme("String_Node_Str")),hasData(hasHost("String_Node_Str")),hasData(hasPath("String_Node_Str")),hasData(hasParamWithName("String_Node_Str")),hasData(not(hasScope("String_Node_Str"))),hasData(hasParamWithName("String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasExtras(allOf(hasEntry(BraintreeBrowserSwitchActivity.EXTRA_BROWSER_SWITCH,true)))));
}

Fixed version (ground truth):
@Test(timeout=5000) public void startsPayWithPayPal() throws InvalidArgumentException, JSONException, InterruptedException {
  Looper.prepare();
  getFragment(true,true,true);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,new PaymentRequest().tokenizationKey(TOKENIZATION_KEY));
  getInstrumentation().waitForIdleSync();
  clickButton(com.braintreepayments.api.dropin.R.id.bt_paypal_button);
  intending(hasAction(equalTo(Intent.ACTION_VIEW))).respondWith(new ActivityResult(0,null));
  intended(allOf(hasAction(equalTo(Intent.ACTION_VIEW)),hasData(hasScheme("String_Node_Str")),hasData(hasHost("String_Node_Str")),hasData(hasPath("String_Node_Str")),hasData(hasParamWithName("String_Node_Str")),hasData(not(hasScope("String_Node_Str"))),hasData(hasParamWithName("String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasData(hasParamWithValue("String_Node_Str","String_Node_Str")),hasExtras(allOf(hasEntry(BraintreeBrowserSwitchActivity.EXTRA_BROWSER_SWITCH,true)))));
}
Program: 165015
Project: 165015
Buggy source:
@Test(timeout=1000) public void onlyShowsPayPal() throws InvalidArgumentException, JSONException {
  getFragment(true,false,false);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,new PaymentRequest().tokenizationKey(TOKENIZATION_KEY));
  getInstrumentation().waitForIdleSync();
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(R.id.bt_payment_button_divider_2).getVisibility());
}

Fixed version (ground truth):
@Test(timeout=1000) public void onlyShowsPayPal() throws InvalidArgumentException, JSONException {
  getFragment(true,false,false);
  mPaymentButton=PaymentButton.newInstance(mActivity,android.R.id.content,new PaymentRequest().tokenizationKey(TOKENIZATION_KEY));
  getInstrumentation().waitForIdleSync();
  assertEquals(View.VISIBLE,mPaymentButton.getView().getVisibility());
  assertEquals(View.VISIBLE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_paypal_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_venmo_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_android_pay_button).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider).getVisibility());
  assertEquals(View.GONE,mPaymentButton.getView().findViewById(com.braintreepayments.api.dropin.R.id.bt_payment_button_divider_2).getVisibility());
}