@Test public void getTopCheckins() { mockServer.expect(requestTo("https: .andExpect(header("Authorization", "Token token=\"ACCESS_TOKEN\"")) .andRespond(withResponse(new ClassPathResource("top_spots.json", getClass()), responseHeaders)); List<Checkin> checkins = gowalla.getTopCheckins("habuma"); assertEquals(3, checkins.size()); assertEquals("Burrito Shack", checkins.get(0).getName()); assertEquals(100, checkins.get(0).getCount()); assertEquals("Chicken Hut", checkins.get(1).getName()); assertEquals(25, checkins.get(1).getCount()); assertEquals("Burger Bell", checkins.get(2).getName()); assertEquals(3, checkins.get(2).getCount()); }
public List<Checkin> getTopCheckins(String userId) { HttpEntity<?> requestEntity = new HttpEntity<String>(buildBaseHeaders()); @SuppressWarnings("rawtypes") ResponseEntity<Map> response = getRestTemplate().exchange(TOP_CHECKINS_URL, HttpMethod.GET, requestEntity, Map.class, userId); @SuppressWarnings("unchecked") List<Map<String, ?>> checkinsList = (List<Map<String, ?>>) response.getBody().get("top_spots"); List<Checkin> checkins = new ArrayList<Checkin>(); for (Map<String, ?> checkinMap : checkinsList) { checkins.add(new Checkin((String) checkinMap.get("name"), (Integer) checkinMap.get("user_checkins_count"))); } return checkins; }
GowallaTemplate extends AbstractOAuth2ApiBinding implements Gowalla { public List<Checkin> getTopCheckins(String userId) { HttpEntity<?> requestEntity = new HttpEntity<String>(buildBaseHeaders()); @SuppressWarnings("rawtypes") ResponseEntity<Map> response = getRestTemplate().exchange(TOP_CHECKINS_URL, HttpMethod.GET, requestEntity, Map.class, userId); @SuppressWarnings("unchecked") List<Map<String, ?>> checkinsList = (List<Map<String, ?>>) response.getBody().get("top_spots"); List<Checkin> checkins = new ArrayList<Checkin>(); for (Map<String, ?> checkinMap : checkinsList) { checkins.add(new Checkin((String) checkinMap.get("name"), (Integer) checkinMap.get("user_checkins_count"))); } return checkins; } }
GowallaTemplate extends AbstractOAuth2ApiBinding implements Gowalla { public List<Checkin> getTopCheckins(String userId) { HttpEntity<?> requestEntity = new HttpEntity<String>(buildBaseHeaders()); @SuppressWarnings("rawtypes") ResponseEntity<Map> response = getRestTemplate().exchange(TOP_CHECKINS_URL, HttpMethod.GET, requestEntity, Map.class, userId); @SuppressWarnings("unchecked") List<Map<String, ?>> checkinsList = (List<Map<String, ?>>) response.getBody().get("top_spots"); List<Checkin> checkins = new ArrayList<Checkin>(); for (Map<String, ?> checkinMap : checkinsList) { checkins.add(new Checkin((String) checkinMap.get("name"), (Integer) checkinMap.get("user_checkins_count"))); } return checkins; } GowallaTemplate(String accessToken); }
GowallaTemplate extends AbstractOAuth2ApiBinding implements Gowalla { public List<Checkin> getTopCheckins(String userId) { HttpEntity<?> requestEntity = new HttpEntity<String>(buildBaseHeaders()); @SuppressWarnings("rawtypes") ResponseEntity<Map> response = getRestTemplate().exchange(TOP_CHECKINS_URL, HttpMethod.GET, requestEntity, Map.class, userId); @SuppressWarnings("unchecked") List<Map<String, ?>> checkinsList = (List<Map<String, ?>>) response.getBody().get("top_spots"); List<Checkin> checkins = new ArrayList<Checkin>(); for (Map<String, ?> checkinMap : checkinsList) { checkins.add(new Checkin((String) checkinMap.get("name"), (Integer) checkinMap.get("user_checkins_count"))); } return checkins; } GowallaTemplate(String accessToken); String getProfileId(); GowallaProfile getUserProfile(); GowallaProfile getUserProfile(String userId); String getProfileUrl(); List<Checkin> getTopCheckins(String userId); }
GowallaTemplate extends AbstractOAuth2ApiBinding implements Gowalla { public List<Checkin> getTopCheckins(String userId) { HttpEntity<?> requestEntity = new HttpEntity<String>(buildBaseHeaders()); @SuppressWarnings("rawtypes") ResponseEntity<Map> response = getRestTemplate().exchange(TOP_CHECKINS_URL, HttpMethod.GET, requestEntity, Map.class, userId); @SuppressWarnings("unchecked") List<Map<String, ?>> checkinsList = (List<Map<String, ?>>) response.getBody().get("top_spots"); List<Checkin> checkins = new ArrayList<Checkin>(); for (Map<String, ?> checkinMap : checkinsList) { checkins.add(new Checkin((String) checkinMap.get("name"), (Integer) checkinMap.get("user_checkins_count"))); } return checkins; } GowallaTemplate(String accessToken); String getProfileId(); GowallaProfile getUserProfile(); GowallaProfile getUserProfile(String userId); String getProfileUrl(); List<Checkin> getTopCheckins(String userId);  }