### Question:
Minitwit { @GET @Path("/public") public Response publicTimeline() { List<Message> messages = dao.getEntityManager() .createQuery("SELECT m FROM Message m ORDER BY m.id DESC", Message.class) .getResultList(); return renderTimeline(messages); }  @GET Response timeline(); @GET @Path("/public") Response publicTimeline(); @GET @Path("/{handle}") Response userTimeline(@PathParam("handle") String handle); @GET @Path("/{handle}/follow") @RolesAllowed("user") Response followUser(@PathParam("handle") String handle); @POST @Path("/addmessage") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @RolesAllowed("user") Response addMessage(@FormParam("text") String text); @GET @Path("/login") View login(); @POST @Path("/login") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response login(
            @FormParam("email") String email,
            @FormParam("password") String password); @GET @Path("/logout") Response logout(); @GET @Path("/register") View register(); @POST @Path("/register") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response register(
            @FormParam("handle") String handle,
            @FormParam("email") String email,
            @FormParam("password") String password); static void main(String[] args);  }### Answer:
@Test public void testPublicTimeline() { final Response response = target("/public").request().get(); assertNotNull(response); assertEquals(200, response.getStatus()); final View view = (View) response.getEntity(); assertNotNull(view); assertEquals("timeline", view.getTemplateName()); assertNotNull(view.getModel().get("messages")); }