### Question:
BasicHeader implements Header, Serializable { Map<String, JsonNode> getTree() { return tree; } BasicHeader(String algorithm, String type, String contentType, String keyId, Map<String, JsonNode> tree, ObjectReader objectReader); @Override String getAlgorithm(); @Override String getType(); @Override String getContentType(); @Override String getKeyId(); @Override Claim getHeaderClaim(String name);  }### Answer:
@SuppressWarnings("Convert2Diamond") @Test public void shouldHaveUnmodifiableTreeWhenInstantiatedWithNonNullTree() throws Exception { exception.expect(UnsupportedOperationException.class); BasicHeader header = new BasicHeader(null, null, null, null, new HashMap<String, JsonNode>(), objectReader); header.getTree().put("something", null); }
@Test public void shouldHaveUnmodifiableTreeWhenInstantiatedWithNullTree() throws Exception { exception.expect(UnsupportedOperationException.class); BasicHeader header = new BasicHeader(null, null, null, null, null, objectReader); header.getTree().put("something", null); }
@Test public void shouldHaveTree() throws Exception { HashMap<String, JsonNode> map = new HashMap<>(); JsonNode node = NullNode.getInstance(); map.put("key", node); BasicHeader header = new BasicHeader(null, null, null, null, map, objectReader); assertThat(header.getTree(), is(notNullValue())); assertThat(header.getTree(), is(IsMapContaining.hasEntry("key", node))); }