@Test
public void testGracefulFailure() throws Exception {

    InstallReferrerReceiver receiver = new InstallReferrerReceiver();
    Intent badIntent = new Intent("bad.action");
    badIntent.setPackage(Robolectric.application.getPackageName());
    String testReferrerData1 = "utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name";
    badIntent.putExtra(InstallReferrerReceiver.ARG_KEY_GPLAY_REFERRER, testReferrerData1);
    receiver.onReceive(Robolectric.application.getApplicationContext(), badIntent);
    Thread.sleep(250);
    String referrerDataFromPreferences = getMatomo().getPreferences().getString(InstallReferrerReceiver.PREF_KEY_INSTALL_REFERRER_EXTRAS, null);
    assertNull(referrerDataFromPreferences);
    Intent nullIntent = new Intent();
    nullIntent.setPackage(Robolectric.application.getPackageName());
    testReferrerData1 = "utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name";
    nullIntent.putExtra(InstallReferrerReceiver.ARG_KEY_GPLAY_REFERRER, testReferrerData1);
    receiver.onReceive(Robolectric.application.getApplicationContext(), nullIntent);
    Thread.sleep(250);
    referrerDataFromPreferences = getMatomo().getPreferences().getString(InstallReferrerReceiver.PREF_KEY_INSTALL_REFERRER_EXTRAS, null);
    assertNull(referrerDataFromPreferences);
}