RealPosClient implements PosClient { @Override public void launchPointOfSale() { List<ResolveInfo> activities = queryChargeActivities(); PackageInfo pointOfSalePackage = findPointOfSaleWithHighestVersion(activities); Intent pointOfSaleIntent = packageManager.getLaunchIntentForPackage(pointOfSalePackage.packageName); context.startActivity(pointOfSaleIntent); } RealPosClient(Context context, String clientId); @NonNull @Override Intent createChargeIntent(@NonNull ChargeRequest chargeRequest); @Override boolean isPointOfSaleInstalled(); @Override void launchPointOfSale(); @Override void openPointOfSalePlayStoreListing(); @NonNull @Override ChargeRequest.Success parseChargeSuccess(@NonNull Intent data); @NonNull @Override ChargeRequest.Error parseChargeError(@NonNull Intent data);  }
@Test(expected = ActivityNotFoundException.class) public void launchPointOfSaleThrowsWithNoPointOfSaleInstalled() { chargeActivities.clear(); client.launchPointOfSale(); }
@Test(expected = ActivityNotFoundException.class) public void launchPointOfSaleThrowsWithInvalidSignature() { chargeActivities.clear(); installApp("com.squareup", 2, INVALID_SIGNATURE); client.launchPointOfSale(); }
@Test public void launchPointOfSale() { client.launchPointOfSale(); Intent expectedIntent = context.getPackageManager().getLaunchIntentForPackage("com.squareup"); verify(context).startActivity(expectedIntent); }