@Test public void createVote() throws IOException { final Response response = WebClient.create("http: .path("api/subject/create") .accept("application/json") .query("name", "TOMEE_JUG_JSON") .post("was it cool?"); final String output = IO.slurp((InputStream) response.getEntity()); assertTrue("output doesn't contain TOMEE_JUG_JSON '" + output + "'", output.contains("TOMEE_JUG_JSON")); }
@POST @Path("create") public Subject create(final String question, @QueryParam("name") final String name) { if (blackList.contains(name)) { throw new IllegalArgumentException("name blacklisted"); } final Subject subject = dao.create(name, question); counter.putSubject(subject); return subject; }
SubjectService { @POST @Path("create") public Subject create(final String question, @QueryParam("name") final String name) { if (blackList.contains(name)) { throw new IllegalArgumentException("name blacklisted"); } final Subject subject = dao.create(name, question); counter.putSubject(subject); return subject; } }
SubjectService { @POST @Path("create") public Subject create(final String question, @QueryParam("name") final String name) { if (blackList.contains(name)) { throw new IllegalArgumentException("name blacklisted"); } final Subject subject = dao.create(name, question); counter.putSubject(subject); return subject; }  }
SubjectService { @POST @Path("create") public Subject create(final String question, @QueryParam("name") final String name) { if (blackList.contains(name)) { throw new IllegalArgumentException("name blacklisted"); } final Subject subject = dao.create(name, question); counter.putSubject(subject); return subject; }  @POST @Path("create") Subject create(final String question, @QueryParam("name") final String name); @GET @Path("list") Collection<Subject> list(); @GET @Path("find/{name}") Subject findByName(@PathParam("name") final String name); @GET @Path("best") Subject best(); @GET @Path("result/{name}") Result result(@PathParam("name") final String name); @POST @Path("vote") Vote vote(final String input, @QueryParam("subject") final String subjectName); }
SubjectService { @POST @Path("create") public Subject create(final String question, @QueryParam("name") final String name) { if (blackList.contains(name)) { throw new IllegalArgumentException("name blacklisted"); } final Subject subject = dao.create(name, question); counter.putSubject(subject); return subject; }  @POST @Path("create") Subject create(final String question, @QueryParam("name") final String name); @GET @Path("list") Collection<Subject> list(); @GET @Path("find/{name}") Subject findByName(@PathParam("name") final String name); @GET @Path("best") Subject best(); @GET @Path("result/{name}") Result result(@PathParam("name") final String name); @POST @Path("vote") Vote vote(final String input, @QueryParam("subject") final String subjectName);  }