### Question:
SearchTemplate extends AbstractTwitterOperations implements SearchOperations { public Trends getLocalTrends(long whereOnEarthId) { return getLocalTrends(whereOnEarthId, false); } SearchTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser, boolean isAuthorizedForApp); SearchResults search(String query); SearchResults search(String query, int resultsPerPage); SearchResults search(String query, int resultsPerPage, long sinceId, long maxId); SearchResults search(SearchParameters searchParameters); List<SavedSearch> getSavedSearches(); SavedSearch getSavedSearch(long searchId); SavedSearch createSavedSearch(String query); void deleteSavedSearch(long searchId); Trends getLocalTrends(long whereOnEarthId); Trends getLocalTrends(long whereOnEarthId, boolean excludeHashtags);  }### Answer:
@Test public void getLocalTrends() { mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("local-trends"), APPLICATION_JSON)); Trends localTrends = twitter.searchOperations().getLocalTrends(2442047); List<Trend> trends = localTrends.getTrends(); assertEquals(2, trends.size()); Trend trend1 = trends.get(0); assertEquals("Cool Stuff", trend1.getName()); assertEquals("Cool+Stuff", trend1.getQuery()); Trend trend2 = trends.get(1); assertEquals("#springsocial", trend2.getName()); assertEquals("%23springsocial", trend2.getQuery()); }
@Test public void getLocalTrends_excludeHashtags() { mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("local-trends"), APPLICATION_JSON)); Trends localTrends = twitter.searchOperations().getLocalTrends(2442047, true); List<Trend> trends = localTrends.getTrends(); assertEquals(2, trends.size()); }
@Test public void getLocalTrends_appAuthorization() { appAuthMockServer.expect(requestTo("https: .andExpect(method(GET)) .andExpect(header("Authorization", "Bearer APP_ACCESS_TOKEN")) .andRespond(withSuccess(jsonResource("local-trends"), APPLICATION_JSON)); Trends localTrends = appAuthTwitter.searchOperations().getLocalTrends(2442047); List<Trend> trends = localTrends.getTrends(); assertEquals(2, trends.size()); Trend trend1 = trends.get(0); assertEquals("Cool Stuff", trend1.getName()); assertEquals("Cool+Stuff", trend1.getQuery()); Trend trend2 = trends.get(1); assertEquals("#springsocial", trend2.getName()); assertEquals("%23springsocial", trend2.getQuery()); }
@Test public void getLocalTrends_excludeHashtags_appAuthorization() { appAuthMockServer.expect(requestTo("https: .andExpect(method(GET)) .andExpect(header("Authorization", "Bearer APP_ACCESS_TOKEN")) .andRespond(withSuccess(jsonResource("local-trends"), APPLICATION_JSON)); Trends localTrends = appAuthTwitter.searchOperations().getLocalTrends(2442047, true); List<Trend> trends = localTrends.getTrends(); assertEquals(2, trends.size()); }