SessionVote { @GET @Path("/ratingsBySession") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) public Collection<SessionRating> allSessionVotes(@QueryParam("sessionId") String sessionId) { return selectedSessionRatingDAO.getRatingsBySession(sessionId); }  @GET @Path("/") @Produces(TEXT_HTML) String info(); @GET @Path("/nessProbe") @Produces(TEXT_PLAIN) Response nessProbe(); void setAttendeeSessionRating(AttendeeDAO attendee, SessionRatingDAO rating); @POST @Path("/attendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) Attendee registerAttendee(Attendee name); @PUT @Path("/attendee/{id}") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) Attendee updateAttendee(@PathParam("id") String id, Attendee attendee); @GET @Path("/attendee") @Produces(APPLICATION_JSON) Collection<Attendee> getAllAttendees(); @GET @Path("/attendee/{id}") @Produces(APPLICATION_JSON) Attendee getAttendee(@PathParam("id") String id); @DELETE @Path("/attendee/{id}") @Produces(APPLICATION_JSON) void deleteAttendee(@PathParam("id") String id); @POST @Path("/rate") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) SessionRating rateSession(SessionRating sessionRating); @GET @Path("/rate") @Produces(APPLICATION_JSON) Collection<SessionRating> getAllSessionRatings(); @PUT @Path("/rate/{id}") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) SessionRating updateRating(@PathParam("id") String id, SessionRating newRating); @GET @Path("/rate/{id}") @Produces(APPLICATION_JSON) SessionRating getRating(@PathParam("id") String id); @DELETE @Path("/rate/{id}") @Produces(APPLICATION_JSON) void deleteRating(@PathParam("id") String id); @GET @Path("/ratingsBySession") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) Collection<SessionRating> allSessionVotes(@QueryParam("sessionId") String sessionId); @GET @Path("/averageRatingBySession") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) double sessionRatingAverage(@QueryParam("sessionId") String sessionId); @GET @Path("/ratingsByAttendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) Collection<SessionRating> votesByAttendee(@QueryParam("attendeeId") String attendeeId);  }
@Test public void testAllSessionVotes() { Attendee attendee1 = sessionVote.registerAttendee(new Attendee("Jon Don")); Attendee attendee2 = sessionVote.registerAttendee(new Attendee("Do Doo")); Attendee attendee3 = sessionVote.registerAttendee(new Attendee("Jo Do")); Attendee attendee4 = sessionVote.registerAttendee(new Attendee("Bo Jo")); SessionRating sr1 = sessionVote.rateSession(new SessionRating("session1", attendee1.getId(), 3)); SessionRating sr2 = sessionVote.rateSession(new SessionRating("session1", attendee2.getId(), 4)); @SuppressWarnings("unused") SessionRating sr3 = sessionVote.rateSession(new SessionRating("session2", attendee3.getId(), 8)); SessionRating sr4 = sessionVote.rateSession(new SessionRating("session1", attendee4.getId(), 9)); Collection<SessionRating> session1Ratings = sessionVote.allSessionVotes("session1"); assertEquals("Unexpected number of ratings for session1", 3, session1Ratings.size()); assertTrue("Returned ratings does not include all submitted ratings for session1", session1Ratings.contains(sr1) && session1Ratings.contains(sr2) && session1Ratings.contains(sr4)); }