BasicApiConnection extends ApiConnection { @JsonProperty("cookies") public List<HttpCookie> getCookies() { return cookieManager.getCookieStore().getCookies(); } BasicApiConnection(String apiBaseUrl); @JsonCreator protected  BasicApiConnection(
			@JsonProperty("baseUrl") String apiBaseUrl,
			@JsonProperty("cookies") List<HttpCookieWrapper> cookies,
			@JsonProperty("username") String username,
			@JsonProperty("loggedIn") boolean loggedIn,
			@JsonProperty("tokens") Map<String, String> tokens,
			@JsonProperty("connectTimeout") int connectTimeout,
			@JsonProperty("readTimeout") int readTimeout); static BasicApiConnection getTestWikidataApiConnection(); static BasicApiConnection getWikidataApiConnection(); static BasicApiConnection getWikimediaCommonsApiConnection(); void login(String username, String password); @JsonProperty("cookies") List<HttpCookie> getCookies(); void clearCookies(); void logout();  }
@Test public void testDeserialize() throws IOException { BasicApiConnection newConnection = mapper.readValue(LOGGED_IN_SERIALIZED_CONNECTION, BasicApiConnection.class); assertTrue(newConnection.isLoggedIn()); assertEquals("username", newConnection.getCurrentUser()); assertEquals(5000, newConnection.getConnectTimeout()); assertEquals(6000, newConnection.getReadTimeout()); assertEquals(server.url("/w/api.php").toString(), newConnection.getApiBaseUrl()); List<HttpCookie> cookies = newConnection.getCookies(); for (HttpCookie cookie : cookies) { if (cookie.getName().equals("GeoIP")) { assertEquals("DE:13:Dresden:51.0500:13.7500:v4", cookie.getValue()); } else { assertEquals("testwikidatawikiSession", cookie.getName()); assertEquals("c18ef92637227283bcda73bcf95cfaf5", cookie.getValue()); } } Map<String, String> tokens = newConnection.getTokens(); assertEquals("b5780b6e2f27e20b450921d9461010b4", tokens.get("login")); assertNull(tokens.get("csrf")); }