### Question:
UserTemplate extends AbstractTwitterOperations implements UserOperations { public List<SuggestionCategory> getSuggestionCategories() { requireEitherUserOrAppAuthorization(); return restTemplate.getForObject(buildUri("users/suggestions.json"), SuggestionCategoryList.class); } UserTemplate(RestTemplate restTemplate, boolean isAuthorizedForUser, boolean isAuthorizedForApp); long getProfileId(); String getScreenName(); TwitterProfile getUserProfile(); TwitterProfile getUserProfile(String screenName); TwitterProfile getUserProfile(long userId); List<TwitterProfile> getUsers(long... userIds); List<TwitterProfile> getUsers(String... screenNames); List<TwitterProfile> searchForUsers(String query); List<TwitterProfile> searchForUsers(String query, int page, int pageSize); List<SuggestionCategory> getSuggestionCategories(); List<TwitterProfile> getSuggestions(String slug); Map<ResourceFamily, List<RateLimitStatus>> getRateLimitStatus(ResourceFamily... resources); AccountSettings getAccountSettings(); AccountSettings updateAccountSettings(AccountSettingsData accountSettingsData);  }### Answer:
@Test public void getSuggestionCategories() { mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("suggestion-categories"), APPLICATION_JSON)); List<SuggestionCategory> categories = twitter.userOperations().getSuggestionCategories(); assertEquals(4, categories.size()); assertEquals("Art & Design", categories.get(0).getName()); assertEquals("art-design", categories.get(0).getSlug()); assertEquals(56, categories.get(0).getSize()); assertEquals("Books", categories.get(1).getName()); assertEquals("books", categories.get(1).getSlug()); assertEquals(72, categories.get(1).getSize()); assertEquals("Business", categories.get(2).getName()); assertEquals("business", categories.get(2).getSlug()); assertEquals(65, categories.get(2).getSize()); assertEquals("Twitter", categories.get(3).getName()); assertEquals("twitter", categories.get(3).getSlug()); assertEquals(16, categories.get(3).getSize()); }
@Test public void getSuggestionCategories_appAuthorization() { appAuthMockServer.expect(requestTo("https: .andExpect(method(GET)) .andExpect(header("Authorization", "Bearer APP_ACCESS_TOKEN")) .andRespond(withSuccess(jsonResource("suggestion-categories"), APPLICATION_JSON)); List<SuggestionCategory> categories = appAuthTwitter.userOperations().getSuggestionCategories(); assertEquals(4, categories.size()); assertEquals("Art & Design", categories.get(0).getName()); assertEquals("art-design", categories.get(0).getSlug()); assertEquals(56, categories.get(0).getSize()); assertEquals("Books", categories.get(1).getName()); assertEquals("books", categories.get(1).getSlug()); assertEquals(72, categories.get(1).getSize()); assertEquals("Business", categories.get(2).getName()); assertEquals("business", categories.get(2).getSlug()); assertEquals(65, categories.get(2).getSize()); assertEquals("Twitter", categories.get(3).getName()); assertEquals("twitter", categories.get(3).getSlug()); assertEquals(16, categories.get(3).getSize()); }