Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from cemcatik/beenHere
Browse files Browse the repository at this point in the history
Venue.beenHere update
  • Loading branch information
mattupstate committed Jul 30, 2012
2 parents 076ead4 + d9173da commit 9ee98ff
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.springframework.social.foursquare.api;

import java.util.List;
import java.util.Map;

public class Venue {

Expand All @@ -20,7 +19,7 @@ public class Venue {
private List<Special> specialsNearby;
private String shortUrl;
private String timezone;
private Map<String,Integer> beenHere;
private VenueBeenHere beenHere;
private PhotoGroups photos;
private String description;

Expand Down Expand Up @@ -123,7 +122,7 @@ public String getTimezone() {
return timezone;
}

public Map<String, Integer> getBeenHere() {
public VenueBeenHere getBeenHere() {
return beenHere;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.springframework.social.foursquare.api;

public class VenueBeenHere {
private int count;
private boolean marked;

public int getCount() {
return count;
}

public void setCount(int count) {
this.count = count;
}

public boolean isMarked() {
return marked;
}

public void setMarked(boolean marked) {
this.marked = marked;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.springframework.social.foursquare.api;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;

public class VenueBeenHereTest {

@Test
public void shouldParseCount() throws JsonParseException, JsonMappingException, IOException {
String beenHereJson = "{\"count\":3}";
ObjectMapper mapper = new ObjectMapper();
VenueBeenHere beenHere = mapper.readValue(beenHereJson, VenueBeenHere.class);
assertEquals(3, beenHere.getCount());
assertFalse(beenHere.isMarked());
}

@Test
public void shouldParseCountAndMarkedFalse() throws JsonParseException, JsonMappingException, IOException {
String beenHereJson = "{\"count\":3, \"marked\":false}";
ObjectMapper mapper = new ObjectMapper();
VenueBeenHere beenHere = mapper.readValue(beenHereJson, VenueBeenHere.class);
assertEquals(3, beenHere.getCount());
assertFalse(beenHere.isMarked());
}

@Test
public void shouldParseCountAndMarkedTrue() throws JsonParseException, JsonMappingException, IOException {
String beenHereJson = "{\"count\":3, \"marked\":true}";
ObjectMapper mapper = new ObjectMapper();
VenueBeenHere beenHere = mapper.readValue(beenHereJson, VenueBeenHere.class);
assertEquals(3, beenHere.getCount());
assertTrue(beenHere.isMarked());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@
"shortUrl":"http://4sq.com/5zCqUz",
"timeZone":"America/New_York",
"beenHere":{
"count":3
"count":3,
"marked":true
},
"photos":{
"count":2,
Expand Down

0 comments on commit 9ee98ff

Please sign in to comment.