### Question:
PayloadImpl implements Payload, Serializable { @Override public Map<String, Claim> getClaims() { Map<String, Claim> claims = new HashMap<>(tree.size() * 2); for (String name : tree.keySet()) { claims.put(name, extractClaim(name, tree, objectReader)); } return Collections.unmodifiableMap(claims); } PayloadImpl(String issuer, String subject, List<String> audience, Date expiresAt, Date notBefore, Date issuedAt, String jwtId, Map<String, JsonNode> tree, ObjectReader objectReader); @Override String getIssuer(); @Override String getSubject(); @Override List<String> getAudience(); @Override Date getExpiresAt(); @Override Date getNotBefore(); @Override Date getIssuedAt(); @Override String getId(); @Override Claim getClaim(String name); @Override Map<String, Claim> getClaims();  }### Answer:
@Test public void shouldGetClaims() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); tree.put("extraClaim", new TextNode("extraValue")); tree.put("sub", new TextNode("auth0")); PayloadImpl payload = new PayloadImpl(null, null, null, null, null, null, null, tree, objectReader); assertThat(payload, is(notNullValue())); Map<String, Claim> claims = payload.getClaims(); assertThat(claims, is(notNullValue())); assertThat(claims.get("extraClaim"), is(notNullValue())); assertThat(claims.get("sub"), is(notNullValue())); }
@Test public void shouldNotAllowToModifyClaimsMap() throws Exception { assertThat(payload, is(notNullValue())); Map<String, Claim> claims = payload.getClaims(); assertThat(claims, is(notNullValue())); exception.expect(UnsupportedOperationException.class); claims.put("name", null); }