### Question:
UserTemplate extends AbstractTwitterOperations implements UserOperations { public Map<ResourceFamily, List<RateLimitStatus>> getRateLimitStatus(ResourceFamily... resources) { requireEitherUserOrAppAuthorization(); String joinedResources = ArrayUtils.join(resources); return restTemplate.getForObject(buildUri("application/rate_limit_status.json", "resources", joinedResources), RateLimitStatusHolder.class).getRateLimits(); } 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 getRateLimit() { mockServer.expect(requestTo("https: .andExpect(method(GET)) .andRespond(withSuccess(jsonResource("rate-limit-status"), APPLICATION_JSON)); Map<ResourceFamily, List<RateLimitStatus>> statuses = twitter.userOperations().getRateLimitStatus(ResourceFamily.HELP,ResourceFamily.SEARCH); assertTrue(statuses.containsKey(ResourceFamily.SEARCH)); assertTrue(statuses.containsKey(ResourceFamily.HELP)); assertEquals(1, statuses.get(ResourceFamily.SEARCH).size()); assertEquals(4, statuses.get(ResourceFamily.HELP).size()); assertEquals("/help/privacy", statuses.get(ResourceFamily.HELP).get(0).getEndpoint()); assertEquals(15, statuses.get(ResourceFamily.HELP).get(0).getQuarterOfHourLimit()); assertEquals("/help/languages", statuses.get(ResourceFamily.HELP).get(3).getEndpoint()); assertEquals(15, statuses.get(ResourceFamily.HELP).get(0).getQuarterOfHourLimit()); assertEquals("/search/tweets", statuses.get(ResourceFamily.SEARCH).get(0).getEndpoint()); assertEquals(180, statuses.get(ResourceFamily.SEARCH).get(0).getQuarterOfHourLimit()); }
@Test public void getRateLimit_appAuthorization() { appAuthMockServer.expect(requestTo("https: .andExpect(method(GET)) .andExpect(header("Authorization", "Bearer APP_ACCESS_TOKEN")) .andRespond(withSuccess(jsonResource("rate-limit-status"), APPLICATION_JSON)); Map<ResourceFamily, List<RateLimitStatus>> statuses = appAuthTwitter.userOperations().getRateLimitStatus(ResourceFamily.HELP,ResourceFamily.SEARCH); assertTrue(statuses.containsKey(ResourceFamily.SEARCH)); assertTrue(statuses.containsKey(ResourceFamily.HELP)); assertEquals(1, statuses.get(ResourceFamily.SEARCH).size()); assertEquals(4, statuses.get(ResourceFamily.HELP).size()); assertEquals("/help/privacy", statuses.get(ResourceFamily.HELP).get(0).getEndpoint()); assertEquals(15, statuses.get(ResourceFamily.HELP).get(0).getQuarterOfHourLimit()); assertEquals("/help/languages", statuses.get(ResourceFamily.HELP).get(3).getEndpoint()); assertEquals(15, statuses.get(ResourceFamily.HELP).get(0).getQuarterOfHourLimit()); assertEquals("/search/tweets", statuses.get(ResourceFamily.SEARCH).get(0).getEndpoint()); assertEquals(180, statuses.get(ResourceFamily.SEARCH).get(0).getQuarterOfHourLimit()); }