### Question:
SwrveInstallReferrerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String referrer = intent.getStringExtra(SwrveImp.REFERRER); SwrveLogger.i("Received INSTALL_REFERRER broadcast with referrer:%s", referrer); if (!SwrveHelper.isNullOrEmpty(referrer)) { try { String decodedReferrer = URLDecoder.decode(referrer, "UTF-8"); SharedPreferences.Editor prefs = context.getSharedPreferences(SwrveImp.SDK_PREFS_NAME, 0).edit(); prefs.putString(SwrveImp.SWRVE_REFERRER_ID, decodedReferrer).apply(); } catch (UnsupportedEncodingException e) { SwrveLogger.e("Error decoding the referrer:" + referrer, e); } } }  @Override void onReceive(Context context, Intent intent);  }### Answer:
@Test public void testSwrveInstallReferrerReceiver() throws Exception { SharedPreferences settings = mActivity.getSharedPreferences(swrveSpy.SDK_PREFS_NAME, 0); settings.edit().remove("swrve.referrer_id").apply(); SwrveInstallReferrerReceiver receiver1 = new SwrveInstallReferrerReceiver(); receiver1.onReceive(mActivity, new Intent()); assertNull(settings.getString("swrve.referrer_id", null)); SwrveInstallReferrerReceiver receiver2 = new SwrveInstallReferrerReceiver(); Intent intent = new Intent(); intent.putExtra("referrer", "http: receiver2.onReceive(mActivity, intent); assertEquals("http: }