This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from cemcatik/beenHere
Venue.beenHere update
- Loading branch information
Showing
4 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ial-foursquare/src/main/java/org/springframework/social/foursquare/api/VenueBeenHere.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...foursquare/src/test/java/org/springframework/social/foursquare/api/VenueBeenHereTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters