@Test public void testGetTopicsReturnsImmutable() { final List<TopicListing> topicListingList = new ArrayList<>(); topicListingList.add(new TopicListing("D", false)); topicListingList.add(new TopicListing("E", false)); topicListingList.add(new TopicListing("F", false)); final TopicList topicList = new TopicList(topicListingList); final List<TopicListing> results = topicList.getTopics(); expectedException.expect(UnsupportedOperationException.class); results.remove(1); }
public List<TopicListing> getTopics() { return topics; }
TopicList { public List<TopicListing> getTopics() { return topics; } }
TopicList { public List<TopicListing> getTopics() { return topics; } TopicList(final List<TopicListing> topics); }
TopicList { public List<TopicListing> getTopics() { return topics; } TopicList(final List<TopicListing> topics); List<TopicListing> getTopics(); List<String> getTopicNames(); TopicList filterByTopicName(final String search); @Override String toString(); }
TopicList { public List<TopicListing> getTopics() { return topics; } TopicList(final List<TopicListing> topics); List<TopicListing> getTopics(); List<String> getTopicNames(); TopicList filterByTopicName(final String search); @Override String toString();  }