@Test public void returns_stu(){ HttpObject subject = new PersonResource(); Request input = new MockRequest(subject, "/people/stu"); Response output = subject.get(input); assertTrue(responseCodeOf(output).isOK_200()); assertTrue(contentTypeOf(output).isPlainTextWithEncoding("utf-8")); assertTrue(bodyOf(output).equals("stu")); }
@Override public Response get(Request req) { String name = req.path().valueFor("name"); if(name!=null && name.equals("stu")){ return OK(Text(name)); }else{ return NOT_FOUND(Text("No such person")); } }
PersonResource extends HttpObject { @Override public Response get(Request req) { String name = req.path().valueFor("name"); if(name!=null && name.equals("stu")){ return OK(Text(name)); }else{ return NOT_FOUND(Text("No such person")); } } }
PersonResource extends HttpObject { @Override public Response get(Request req) { String name = req.path().valueFor("name"); if(name!=null && name.equals("stu")){ return OK(Text(name)); }else{ return NOT_FOUND(Text("No such person")); } } PersonResource(); }
PersonResource extends HttpObject { @Override public Response get(Request req) { String name = req.path().valueFor("name"); if(name!=null && name.equals("stu")){ return OK(Text(name)); }else{ return NOT_FOUND(Text("No such person")); } } PersonResource(); @Override Response get(Request req); }
PersonResource extends HttpObject { @Override public Response get(Request req) { String name = req.path().valueFor("name"); if(name!=null && name.equals("stu")){ return OK(Text(name)); }else{ return NOT_FOUND(Text("No such person")); } } PersonResource(); @Override Response get(Request req);  }