@Test
public void testShouldSuccess() throws Exception {
final Request r = newRequest();
final RequestListener l = mock(RequestListener.class);
r.setListener(l);
final IInAppBillingService service = mock(IInAppBillingService.class);
when(service.isBillingSupported(anyInt(), anyString(), anyString())).thenReturn(OK);
when(service.consumePurchase(anyInt(), anyString(), anyString())).thenReturn(OK);
final Bundle purchases = new Bundle();
purchases.putStringArrayList("INAPP_PURCHASE_DATA_LIST", new ArrayList<String>());
when(service.getPurchases(anyInt(), anyString(), anyString(), anyString())).thenReturn(purchases);
when(service.getPurchaseHistory(anyInt(), anyString(), anyString(), anyString(), any(Bundle.class))).thenReturn(purchases);
final Bundle skuDetails = new Bundle();
skuDetails.putStringArrayList("DETAILS_LIST", new ArrayList<String>());
when(service.getSkuDetails(anyInt(), anyString(), anyString(), any(Bundle.class))).thenReturn(skuDetails);
final Bundle buyIntent = new Bundle();
buyIntent.putParcelable("BUY_INTENT", PendingIntent.getActivity(RuntimeEnvironment.application, 100, new Intent(), 0));
when(service.getBuyIntent(anyInt(), anyString(), anyString(), anyString(), anyString())).thenReturn(buyIntent);
r.start(service, "");
verify(l).onSuccess(anyObject());
verify(l, never()).onError(anyInt(), any(Exception.class));
}