@Test public void collectPayPalDeviceData() throws JSONException, InterruptedException { final BraintreeFragment fragment = new MockFragmentBuilder().build(); final CountDownLatch latch = new CountDownLatch(1); DataCollector.collectPayPalDeviceData(fragment, new BraintreeResponseListener<String>() { @Override public void onResponse(String s) { try { JSONObject json = new JSONObject(s); assertNotNull(json.getString("correlation_id")); } catch (JSONException e) { fail(); } latch.countDown(); } }); latch.await(); } }