OAuthUser implements Serializable { public String getLogin() { return userData.get(PARAM_LOGIN); } OAuthUser(String jsonStr, OAuthServer server);  OAuthUser(Map<String, String> umap); Map<String, String> getUserData(); String getLogin(); String getEmail(); static final String PARAM_LOGIN; static final String PARAM_EMAIL; static final String PARAM_FNAME; static final String PARAM_LNAME; }
@Test void thirdLevel() { OAuthServer server = new OAuthServer() .addMapping(PARAM_LOGIN, "id") .addMapping(PARAM_EMAIL, "email") .addMapping(PARAM_FNAME, "display-name"); OAuthUser user = new OAuthUser("{\n" + " \"ocs\": {\n" + " \"meta\": {\n" + " \"status\": \"ok\",\n" + " \"statuscode\": 200,\n" + " \"message\": \"OK\"\n" + " },\n" + " \"data\": {\n" + " \"storageLocation\": \"xxxxx\",\n" + " \"id\": \"xxxxx\",\n" + " \"lastLogin\": 1584799957000,\n" + " \"backend\": \"Database\",\n" + " \"subadmin\": [],\n" + " \"quota\": {\n" + " \"free\": 183035547648,\n" + " \"used\": 10244,\n" + " \"total\": 183035557892,\n" + " \"relative\": 0,\n" + " \"quota\": -3\n" + " },\n" + " \"email\": \"xxxxxx@xxx.x\",\n" + " \"phone\": \"\",\n" + " \"address\": \"\",\n" + " \"website\": \"\",\n" + " \"twitter\": \"\",\n" + " \"groups\": [\n" + " \"xxxxxx\"\n" + " ],\n" + " \"language\": \"en\",\n" + " \"locale\": \"\",\n" + " \"backendCapabilities\": {\n" + " \"setDisplayName\": true,\n" + " \"setPassword\": true\n" + " },\n" + " \"display-name\": \"xxxxx\"\n" + " }\n" + " }\n" + "}", server); assertEquals("xxxxx", user.getLogin(), "Login should be correct"); }