@Test public void testRegisterAttendee() { Attendee johnDoe = sessionVote.registerAttendee(new Attendee("John Doe")); assertEquals("Unexpected name returned for registered attendee", "John Doe", johnDoe.getName()); Attendee janeDoe = sessionVote.registerAttendee(new Attendee("Jane Doe")); assertEquals("Unexpected name returned for second registered attendee", "Jane Doe", janeDoe.getName()); assertNotEquals("Both attendees have the same ID", johnDoe.getId(), janeDoe.getId()); Collection<Attendee> attendees = sessionVote.getAllAttendees(); assertTrue("The session vote service is missing the first registered attendee", attendees.contains(johnDoe)); assertTrue("The session vote service is missing the second registered attendee", attendees.contains(janeDoe)); }
@POST @Path("/attendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) public Attendee registerAttendee(Attendee name) { Attendee attendee = selectedAttendeeDAO.createNewAttendee(name); return attendee; }
SessionVote { @POST @Path("/attendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) public Attendee registerAttendee(Attendee name) { Attendee attendee = selectedAttendeeDAO.createNewAttendee(name); return attendee; } }
SessionVote { @POST @Path("/attendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) public Attendee registerAttendee(Attendee name) { Attendee attendee = selectedAttendeeDAO.createNewAttendee(name); return attendee; }  }
SessionVote { @POST @Path("/attendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) public Attendee registerAttendee(Attendee name) { Attendee attendee = selectedAttendeeDAO.createNewAttendee(name); return attendee; }  @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); }
SessionVote { @POST @Path("/attendee") @Produces(APPLICATION_JSON) @Consumes(APPLICATION_JSON) public Attendee registerAttendee(Attendee name) { Attendee attendee = selectedAttendeeDAO.createNewAttendee(name); return attendee; }  @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);  }