@Test
public void getLaunchIntent_containsCorrectVenmoExtras() throws JSONException, InvalidArgumentException {
Configuration configuration = getConfigurationFromFixture();
BraintreeFragment fragment = new MockFragmentBuilder()
.authorization(Authorization.fromString(stringFromFixture("client_token.json")))
.configuration(configuration)
.sessionId("session-id")
.build();
when(fragment.getIntegrationType()).thenReturn("custom");
Intent intent = Venmo.getLaunchIntent(configuration.getPayWithVenmo(),
configuration.getPayWithVenmo().getMerchantId(), fragment);
assertEquals(new ComponentName("com.venmo", "com.venmo.controller.SetupMerchantActivity"),
intent.getComponent());
assertEquals("merchant-id", intent.getStringExtra(Venmo.EXTRA_MERCHANT_ID));
assertEquals("access-token", intent.getStringExtra(Venmo.EXTRA_ACCESS_TOKEN));
assertEquals("environment", intent.getStringExtra(Venmo.EXTRA_ENVIRONMENT));
JSONObject braintreeData = new JSONObject(intent.getStringExtra(Venmo.EXTRA_BRAINTREE_DATA));
JSONObject meta = braintreeData.getJSONObject("_meta");
assertNotNull(meta);
assertEquals("session-id", meta.getString("sessionId"));
assertEquals("custom", meta.getString("integration"));
assertEquals(BuildConfig.VERSION_NAME, meta.getString("version"));
assertEquals("android", meta.getString("platform"));
}