### Question:
FacetedSearchService { public String updateQueryWithExcludedObjects(String query, String rowQueryParameters) { if (query != null) { String[] objectsToExcludeArray = getObjectsToExclude(); String subQuery = getObjectsToExcludeSubQuery(objectsToExcludeArray, rowQueryParameters); if (!"".equals(subQuery)) { query += " " + SearchConstants.OPERATOR_AND + " " + subQuery; } } return query; }  String buildHiddenDocumentsFilter(); String getFacetKeys(); String buildSolrQuery(String filter); String updateQueryWithExcludedObjects(String query, String rowQueryParameters); String replaceEventTypeName(String solrResult); String escapeQueryChars(String s); String escapeTermsInQuery(String query); SearchConfig getSearchConfig(); void setSearchConfig(SearchConfig searchConfig); AuditEventConfig getAuditEventConfig(); void setAuditEventConfig(AuditEventConfig auditEventConfig); JSONObject getParentDocumentJsonObject(Authentication authentication, String res); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery);  }### Answer:
@Test public void updateQueryWithExcludedObjects_excludeByDefault() { String query = "ann.*"; String updatedQuery = unit.updateQueryWithExcludedObjects(query, "filter=fq=myfield:myvalue"); assertEquals("ann.* AND -object_type_s:BAND AND -object_type_s:AUTHOR", updatedQuery); }
@Test public void updateQueryWithExcludedObjects_includeIfSpecificallyRequested() throws Exception { String query = "ann.*"; String updatedQuery = unit.updateQueryWithExcludedObjects(query, URLEncoder.encode("{!field f=object_type_facet}BAND", SearchConstants.FACETED_SEARCH_ENCODING)); assertEquals("ann.* AND -object_type_s:AUTHOR", updatedQuery); query = "ann.*"; updatedQuery = unit.updateQueryWithExcludedObjects(query, URLEncoder.encode("{!field f=object_type_s}BAND", SearchConstants.FACETED_SEARCH_ENCODING)); assertEquals("ann.* AND -object_type_s:AUTHOR", updatedQuery); }