### Question:
FeedRestService extends RestServiceBase { protected String constructFeedTitle(QuerySettings querySettings) { StringBuilder sb = new StringBuilder(); Filters f = querySettings.getFiltersInit(); appendParamIfExists(sb, "project", f.getFilterCandidateValues("project")); appendParamIfExists(sb, "contributor", f.getFilterCandidateValues("contributor")); appendParamIfExists(sb, "tag", f.getFilterCandidateValues("tag")); appendParamIfExists(sb, "sys_type", f.getFilterCandidateValues("sys_type")); appendParamIfExists(sb, "type", f.getFilterCandidateValues("type")); appendParamIfExists(sb, "content_provider", f.getFilterCandidateValues("content_provider")); appendParamIfExists(sb, "query", querySettings.getQuery(), true); if (querySettings.getSortBy() != null && querySettings.getSortBy() != SortByValue.NEW) appendParamIfExists(sb, "sortBy", querySettings.getSortBy().toString()); if (sb.length() == 0) return "Whole feed content"; else return "Feed content for criteria " + sb.toString(); }  @GET @Path("/") @Produces(MediaType.APPLICATION_ATOM_XML) @PermitAll Object feed(@Context UriInfo uriInfo);  }### Answer:
@Test public void constructFeedTitle() throws URISyntaxException { FeedRestService tested = getTested(); { QuerySettings querySettings = new QuerySettings(); Assert.assertEquals("Whole feed content", tested.constructFeedTitle(querySettings)); } { QuerySettings querySettings = new QuerySettings(); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(CONTENT_TYPE_KEY, "content_type"); Assert.assertEquals("Feed content for criteria type=[content_type]", tested.constructFeedTitle(querySettings)); } { QuerySettings querySettings = new QuerySettings(); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(PROJECTS_KEY, "as7"); Assert.assertEquals("Feed content for criteria project=[as7]", tested.constructFeedTitle(querySettings)); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(PROJECTS_KEY, "as7", "aerogear"); Assert.assertEquals("Feed content for criteria project=[as7, aerogear]", tested.constructFeedTitle(querySettings)); } { QuerySettings querySettings = new QuerySettings(); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(PROJECTS_KEY, "as7", "aerogear"); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(TAGS_KEY, "tag1", "tag2"); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(CONTENT_TYPE_KEY, "content_type"); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(SYS_CONTENT_PROVIDER, "jbossorg"); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(SYS_TYPES_KEY, "issue", "blogpost"); querySettings.getFiltersInit().acknowledgeUrlFilterCandidate(CONTRIBUTORS_KEY, "John Doe <john@doe.org>"); querySettings.setQuery("querry me fulltext"); querySettings.setSortBy(SortByValue.NEW_CREATION); Assert .assertEquals( "Feed content for criteria project=[as7, aerogear] and contributor=[John Doe <john@doe.org>] and tag=[tag1, tag2] and sys_type=[issue, blogpost] and type=[content_type] and content_provider=[jbossorg] and query='querry me fulltext' and sortBy=new-create", tested.constructFeedTitle(querySettings)); } }