@Test public void testFindRefTagCookieForProject_WhenCookieDoesNotExist() { final CookieManager cookieManager = new CookieManager(); final Project project = ProjectFactory.project(); final HttpCookie cookie = RefTagUtils.findRefTagCookieForProject(project, cookieManager, sharedPreferences); assertNull(cookie); }
protected static @Nullable HttpCookie findRefTagCookieForProject(final @NonNull Project project, final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences) { final String cookieName = cookieNameForProject(project); final CookieStore cookieStore = cookieManager.getCookieStore(); for (final HttpCookie cookie : cookieStore.getCookies()) { if (cookieName.equals(cookie.getName())) { return cookie; } } final String cookieValue = sharedPreferences.getString(cookieName, null); if (cookieValue != null) { return buildCookieWithValueAndProject(cookieValue, project); } return null; }
RefTagUtils { protected static @Nullable HttpCookie findRefTagCookieForProject(final @NonNull Project project, final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences) { final String cookieName = cookieNameForProject(project); final CookieStore cookieStore = cookieManager.getCookieStore(); for (final HttpCookie cookie : cookieStore.getCookies()) { if (cookieName.equals(cookie.getName())) { return cookie; } } final String cookieValue = sharedPreferences.getString(cookieName, null); if (cookieValue != null) { return buildCookieWithValueAndProject(cookieValue, project); } return null; } }
RefTagUtils { protected static @Nullable HttpCookie findRefTagCookieForProject(final @NonNull Project project, final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences) { final String cookieName = cookieNameForProject(project); final CookieStore cookieStore = cookieManager.getCookieStore(); for (final HttpCookie cookie : cookieStore.getCookies()) { if (cookieName.equals(cookie.getName())) { return cookie; } } final String cookieValue = sharedPreferences.getString(cookieName, null); if (cookieValue != null) { return buildCookieWithValueAndProject(cookieValue, project); } return null; } private  RefTagUtils(); }
RefTagUtils { protected static @Nullable HttpCookie findRefTagCookieForProject(final @NonNull Project project, final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences) { final String cookieName = cookieNameForProject(project); final CookieStore cookieStore = cookieManager.getCookieStore(); for (final HttpCookie cookie : cookieStore.getCookies()) { if (cookieName.equals(cookie.getName())) { return cookie; } } final String cookieValue = sharedPreferences.getString(cookieName, null); if (cookieValue != null) { return buildCookieWithValueAndProject(cookieValue, project); } return null; } private  RefTagUtils(); static @Nullable RefTag storedCookieRefTagForProject(final @NonNull Project project,
    final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences); static @Nullable HttpCookie buildCookieWithRefTagAndProject(final @NonNull RefTag refTag,
    final @NonNull Project project); static @NonNull Pair<Project, RefTag> projectAndRefTagFromParamsAndProject(final @NonNull DiscoveryParams params,
    final @NonNull Project project); static void storeCookie(final @NonNull RefTag refTag, final @NonNull Project project,
    final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences); }
RefTagUtils { protected static @Nullable HttpCookie findRefTagCookieForProject(final @NonNull Project project, final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences) { final String cookieName = cookieNameForProject(project); final CookieStore cookieStore = cookieManager.getCookieStore(); for (final HttpCookie cookie : cookieStore.getCookies()) { if (cookieName.equals(cookie.getName())) { return cookie; } } final String cookieValue = sharedPreferences.getString(cookieName, null); if (cookieValue != null) { return buildCookieWithValueAndProject(cookieValue, project); } return null; } private  RefTagUtils(); static @Nullable RefTag storedCookieRefTagForProject(final @NonNull Project project,
    final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences); static @Nullable HttpCookie buildCookieWithRefTagAndProject(final @NonNull RefTag refTag,
    final @NonNull Project project); static @NonNull Pair<Project, RefTag> projectAndRefTagFromParamsAndProject(final @NonNull DiscoveryParams params,
    final @NonNull Project project); static void storeCookie(final @NonNull RefTag refTag, final @NonNull Project project,
    final @NonNull CookieManager cookieManager, final @NonNull SharedPreferences sharedPreferences);  }