HelloResource { @GET @Path("{name}") public String hello(@PathParam("name") final String name) { return greeter.greet(name); } @Inject  HelloResource(final Greeter greeter); @GET @Path("{name}") String hello(@PathParam("name") final String name);  }
@Test public void testHello() { final HelloResource helloResource = new HelloResource(new Greeter() { public String greet(final String name) { return "greeting"; } }); Assert.assertEquals("greeting", helloResource.hello("foo")); }