BasicVotesJsonParser implements JsonParser<BasicVotes> { @Override public BasicVotes parse(JSONObject json) throws JSONException { final URI self = JsonParseUtil.getSelfUri(json); final int voteCount = json.getInt("votes"); final boolean hasVoted = json.getBoolean("hasVoted"); return new BasicVotes(self, voteCount, hasVoted); }  @Override BasicVotes parse(JSONObject json);  }
@Test public void testParse() throws JSONException { final BasicVotesJsonParser parser = new BasicVotesJsonParser(); final BasicVotes basicVotes = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/votes/valid.json")); assertEquals(1, basicVotes.getVotes()); assertTrue(basicVotes.hasVoted()); assertEquals(TestUtil.toUri("http: }