HeadersImpl implements Headers { @Override public void add(String headerName, String value) { get(headerName).add(value); } private  HeadersImpl(boolean readOnly);  HeadersImpl();  HeadersImpl(Headers headers, boolean readOnly); @Override List<String> get(String headerName); @Override void add(String headerName, String value); @Override void put(String headerName, String value); @Override String getFirst(String headerName); @Override Set<String> headerNames(); @Override long getContentLength(); @Override void setContentLength(long contentLength); @Override ContentType getContentType(); @Override void setContentType(ContentType contentType);  }
@Test(expected = UnsupportedOperationException.class) public void readOnlyViewShouldNotSupportAdd() { final HeadersImpl readOnlyHeaders = new HeadersImpl(new HeadersImpl(), true); readOnlyHeaders.add("Content-Type", "application/json"); }