RefreshToken extends Model { public static Model fromMap(Map<String, Object> map) { return new RefreshToken( (String) map.get("id"), (byte[]) map.get("value"), (Long) map.get("creationTime") ); } RefreshToken(@JsonProperty("id") String id,
                        @JsonProperty("value") byte[] value,
                        @JsonProperty("creationTime") Long creationTime); @Override Map<String, Object> toMap(); static Model fromMap(Map<String, Object> map); void setDBId(String id); String getDBId(); String getId(); void setId(String id); byte[] getValue(); void setValue(byte[] value); Long getCreationTime(); void setCreationTime(Long creationTime);  }
@Test public void testFromMap() { HashMap<String, Object> values = new HashMap<String, Object>(); values.put("id", "alice@example.com"); values.put("creationTime", 2222222222222L); values.put("value", "xyz".getBytes()); RefreshToken token = (RefreshToken) Model.fromMap(RefreshToken.class, values); assertEquals("alice@example.com", token.getId()); assertEquals(2222222222222L, token.getCreationTime().longValue()); assertArrayEquals("xyz".getBytes(), token.getValue()); }