PriamInstanceResource { @DELETE @Path("{id}") public Response deleteInstance(@PathParam("id") int id) { PriamInstance instance = getByIdIfFound(id); factory.delete(instance); return Response.noContent().build(); } @Inject // Note: do not parameterize the generic type variable to an implementation as it confuses // Guice in the binding.  PriamInstanceResource(
            IConfiguration config, IPriamInstanceFactory factory, InstanceInfo instanceInfo); @GET String getInstances(); @GET @Path("{id}") String getInstance(@PathParam("id") int id); @POST Response createInstance(
            @QueryParam("id") int id,
            @QueryParam("instanceID") String instanceID,
            @QueryParam("hostname") String hostname,
            @QueryParam("ip") String ip,
            @QueryParam("rack") String rack,
            @QueryParam("token") String token); @DELETE @Path("{id}") Response deleteInstance(@PathParam("id") int id);  }
@Test public void deleteInstance(@Mocked final PriamInstance instance) { new Expectations() { { config.getAppName(); result = APP_NAME; factory.getInstance(APP_NAME, instanceInfo.getRegion(), NODE_ID); result = instance; factory.delete(instance); } }; Response response = resource.deleteInstance(NODE_ID); assertEquals(204, response.getStatus()); }