@Test public void testClear() { Context app = RuntimeEnvironment.application; HttpUrl url = HttpUrl.parse("http: Cookie cookie = new Cookie.Builder() .name("user") .value("1234567890") .domain("ehviewer.com") .path("/") .expiresAt(System.currentTimeMillis() + 3000) .build(); CookieRepository repository = new CookieRepository(app, "cookie.db"); repository.saveFromResponse(url, Collections.singletonList(cookie)); Map<String, CookieSet> map = Reflect.on(repository).field("map").get(); assertEquals(1, map.size()); equals(map.get("ehviewer.com"), Collections.singletonList(cookie)); repository.clear(); map = Reflect.on(repository).field("map").get(); assertEquals(0, map.size()); repository.close(); repository = new CookieRepository(app, "cookie.db"); map = Reflect.on(repository).field("map").get(); assertEquals(0, map.size()); repository.close(); }
public synchronized void clear() { map.clear(); db.clear(); }
CookieRepository implements CookieJar { public synchronized void clear() { map.clear(); db.clear(); } }
CookieRepository implements CookieJar { public synchronized void clear() { map.clear(); db.clear(); } CookieRepository(Context context, String name); }
CookieRepository implements CookieJar { public synchronized void clear() { map.clear(); db.clear(); } CookieRepository(Context context, String name); synchronized void addCookie(Cookie cookie); String getCookieHeader(HttpUrl url); synchronized List<Cookie> getCookies(HttpUrl url); boolean contains(HttpUrl url, String name); synchronized void clear(); synchronized void close(); @Override void saveFromResponse(HttpUrl httpUrl, List<Cookie> list); @Override List<Cookie> loadForRequest(HttpUrl httpUrl); }
CookieRepository implements CookieJar { public synchronized void clear() { map.clear(); db.clear(); } CookieRepository(Context context, String name); synchronized void addCookie(Cookie cookie); String getCookieHeader(HttpUrl url); synchronized List<Cookie> getCookies(HttpUrl url); boolean contains(HttpUrl url, String name); synchronized void clear(); synchronized void close(); @Override void saveFromResponse(HttpUrl httpUrl, List<Cookie> list); @Override List<Cookie> loadForRequest(HttpUrl httpUrl);  }