@Test public void loadCachedReleaseDetailsNull() { mockStatic(SharedPreferencesManager.class); when(SharedPreferencesManager.getString(PREFERENCE_KEY_RELEASE_DETAILS)).thenReturn(null); ReleaseDetails releaseDetails = DistributeUtils.loadCachedReleaseDetails(); assertNull(releaseDetails); verifyStatic(never()); SharedPreferencesManager.remove(eq(PREFERENCE_KEY_RELEASE_DETAILS)); }
static ReleaseDetails loadCachedReleaseDetails() { String cachedReleaseDetails = SharedPreferencesManager.getString(PREFERENCE_KEY_RELEASE_DETAILS); if (cachedReleaseDetails != null) { try { return ReleaseDetails.parse(cachedReleaseDetails); } catch (JSONException e) { AppCenterLog.error(LOG_TAG, "Invalid release details in cache.", e); SharedPreferencesManager.remove(PREFERENCE_KEY_RELEASE_DETAILS); } } return null; }
DistributeUtils { static ReleaseDetails loadCachedReleaseDetails() { String cachedReleaseDetails = SharedPreferencesManager.getString(PREFERENCE_KEY_RELEASE_DETAILS); if (cachedReleaseDetails != null) { try { return ReleaseDetails.parse(cachedReleaseDetails); } catch (JSONException e) { AppCenterLog.error(LOG_TAG, "Invalid release details in cache.", e); SharedPreferencesManager.remove(PREFERENCE_KEY_RELEASE_DETAILS); } } return null; } }
DistributeUtils { static ReleaseDetails loadCachedReleaseDetails() { String cachedReleaseDetails = SharedPreferencesManager.getString(PREFERENCE_KEY_RELEASE_DETAILS); if (cachedReleaseDetails != null) { try { return ReleaseDetails.parse(cachedReleaseDetails); } catch (JSONException e) { AppCenterLog.error(LOG_TAG, "Invalid release details in cache.", e); SharedPreferencesManager.remove(PREFERENCE_KEY_RELEASE_DETAILS); } } return null; }  }
DistributeUtils { static ReleaseDetails loadCachedReleaseDetails() { String cachedReleaseDetails = SharedPreferencesManager.getString(PREFERENCE_KEY_RELEASE_DETAILS); if (cachedReleaseDetails != null) { try { return ReleaseDetails.parse(cachedReleaseDetails); } catch (JSONException e) { AppCenterLog.error(LOG_TAG, "Invalid release details in cache.", e); SharedPreferencesManager.remove(PREFERENCE_KEY_RELEASE_DETAILS); } } return null; }   }
DistributeUtils { static ReleaseDetails loadCachedReleaseDetails() { String cachedReleaseDetails = SharedPreferencesManager.getString(PREFERENCE_KEY_RELEASE_DETAILS); if (cachedReleaseDetails != null) { try { return ReleaseDetails.parse(cachedReleaseDetails); } catch (JSONException e) { AppCenterLog.error(LOG_TAG, "Invalid release details in cache.", e); SharedPreferencesManager.remove(PREFERENCE_KEY_RELEASE_DETAILS); } } return null; }    }