Session extends Model { public static Model fromMap(Map<String, Object> map) { return new Session( (String) map.get("id"), (String) map.get("owner"), (String) map.get("renewer"), (String) map.get("target"), (String) map.get("scopes"), (Long) map.get("expiresAt"), (Long) map.get("creationTime") ); } Session(@JsonProperty("id") String id,
                   @JsonProperty("owner") String owner,
                   @JsonProperty("renewer") String renewer,
                   @JsonProperty("target") String target,
                   @JsonProperty("scopes") String scopes,
                   @JsonProperty("expiresAt") Long expiresAt,
                   @JsonProperty("creationTime") Long creationTime); void setDBId(String id); String getDBId(); Map<String, Object> toMap(); static Model fromMap(Map<String, Object> map); void extendLifetime(); @JsonIgnore boolean isExpired(); String getId(); void setId(String id); String getOwner(); void setOwner(String owner); String getRenewer(); void setRenewer(String renewer); String getTarget(); void setTarget(String target); String getScopes(); void setScopes(String scopes); Long getExpiresAt(); void setExpiresAt(Long expiresAt); Long getCreationTime(); void setCreationTime(Long creationTime);  }
@Test public void testFromMap() { HashMap<String, Object> values = new HashMap<String, Object>(); values.put("id", "123456789"); values.put("owner", ALICE); values.put("renewer", YARN); values.put("target", MOCK_BUCKET); values.put("scopes", GCS); values.put("creationTime", 11111111111111L); values.put("expiresAt", 2222222222222L); Session session = (Session) Model.fromMap(Session.class, values); assertEquals("123456789", session.getId()); assertEquals(ALICE, session.getOwner()); assertEquals(YARN, session.getRenewer()); assertEquals(MOCK_BUCKET, session.getTarget()); assertEquals(GCS, session.getScopes()); assertEquals(11111111111111L, session.getCreationTime().longValue()); assertEquals(2222222222222L, session.getExpiresAt().longValue()); }