ArtifactsResource { @Timed @GET @Path("/config.tgz") public Response getConfig() throws InterruptedException { File file = new File(myriadEtc); Response.ResponseBuilder response; if (file.exists()) { response = Response.ok((Object) file); response.header("Content-Disposition", "attachment; filename=" + file.getName()); } else { response = Response.status(Response.Status.BAD_REQUEST) .entity("Path does not exist"); } return response.build(); } @Inject  ArtifactsResource(MyriadConfiguration cfg); @Timed @GET @Path("/config.tgz") Response getConfig(); @Timed @GET @Path("/binary.tgz") Response getBinary();  }
@Test public void testGetConfig() throws Exception { Response res = resource.getConfig(); assertEquals(configFile, res.getEntity()); assertEquals(200, res.getStatus()); }