@Test(expected = UnsupportedOperationException.class) public void listShouldBeunmodifiableList(){ ContentType xmlContentType = ContentType.createContentType("application/xml"); ContentType jsonContentType = ContentType.createContentType("application/json"); ContentType rssXmlContentType = ContentType.createContentType("application/rss+xml"); ContentTypes contentTypes = new ContentTypes(xmlContentType, jsonContentType, rssXmlContentType); List<ContentType> list = contentTypes.getListOfContentTypes(); list.add(xmlContentType); }
public List<ContentType> getListOfContentTypes() { return Collections.unmodifiableList(contentTypes); }
ContentTypes { public List<ContentType> getListOfContentTypes() { return Collections.unmodifiableList(contentTypes); } }
ContentTypes { public List<ContentType> getListOfContentTypes() { return Collections.unmodifiableList(contentTypes); } ContentTypes(ContentType... arrayOfContentTypes); }
ContentTypes { public List<ContentType> getListOfContentTypes() { return Collections.unmodifiableList(contentTypes); } ContentTypes(ContentType... arrayOfContentTypes); List<ContentType> getListOfContentTypes(); }
ContentTypes { public List<ContentType> getListOfContentTypes() { return Collections.unmodifiableList(contentTypes); } ContentTypes(ContentType... arrayOfContentTypes); List<ContentType> getListOfContentTypes();  }