FileViewer { @GET @Path("list") @Produces(MediaType.TEXT_PLAIN) public Response list() { String[] files = getFileList(); String list = ""; for (String f : files) { list += f + "\r\n"; } return Response.status(200).entity(list).build(); }  @GET @Path("{filename}") @Produces(MediaType.TEXT_PLAIN) Response get(@PathParam("filename") final String file); @GET @Path("list") @Produces(MediaType.TEXT_PLAIN) Response list(); @GET @Path("{filename}/json") @Produces(MediaType.APPLICATION_JSON) Response json(@PathParam("filename") final String file);  }
@Test public void shouldListFiles() { Response response = fileViewer.list(); Assert.assertTrue(((String) response.getEntity()).contains(getAvailableFile())); }