### Question:
WelcomeMessage extends WampMessage { @SuppressWarnings("unchecked") public static WelcomeMessage deserialize(JsonParser jp) throws IOException { jp.nextToken(); long session = jp.getLongValue(); List<WampRole> roles = new ArrayList<>(); String realm = null; jp.nextToken(); Map<String, Object> details = ParserUtil.readObject(jp); if (details != null) { Map<String, Map<String, Map<String, Boolean>>> rolesMap = (Map<String, Map<String, Map<String, Boolean>>>) details .get("roles"); for (Map.Entry<String, Map<String, Map<String, Boolean>>> entry : rolesMap .entrySet()) { WampRole wampRole = new WampRole(entry.getKey()); Map<String, Boolean> features = entry.getValue().get("features"); if (features != null) { for (String feature : features.keySet()) { wampRole.addFeature(feature); } } roles.add(wampRole); } realm = (String) details.get("realm"); } return new WelcomeMessage(session, roles, realm); } WelcomeMessage(long sessionId, List<WampRole> roles, @Nullable String realm);  WelcomeMessage(HelloMessage helloMessage, long sessionId,
			List<WampRole> roles); @SuppressWarnings("unchecked") static WelcomeMessage deserialize(JsonParser jp); @Override void serialize(JsonGenerator generator); long getSessionId(); List<WampRole> getRoles(); @Nullable String getRealm(); @Override String toString();  }### Answer:
@Test public void deserializeTest() throws IOException { String json = "[ 2 , 9129137332 , { \"roles\" : { \"broker\" : {} }}]"; WelcomeMessage welcomeMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(welcomeMessage.getCode()).isEqualTo(2); assertThat(welcomeMessage.getSessionId()).isEqualTo(9129137332L); assertThat(welcomeMessage.getRoles()).containsExactly(new WampRole("broker")); json = "[2,9129137332,{\"roles\":{\"dealer\":{\"features\":{\"caller_identification\":true}},\"broker\":{\"features\":{\"subscriber_blackwhite_listing\":true,\"publisher_exclusion\":true,\"publisher_identification\":true,\"pattern_based_subscription\":true}}},\"realm\":\"realm\"}]"; welcomeMessage = WampMessage.deserialize(getJsonFactory(), json.getBytes(StandardCharsets.UTF_8)); assertThat(welcomeMessage.getCode()).isEqualTo(2); assertThat(welcomeMessage.getSessionId()).isEqualTo(9129137332L); assertThat(welcomeMessage.getRoles()).containsOnlyElementsOf(createRoles()); }