### Question:
CassandraInstanceResource { @POST public Response createInstance(@Valid CassandraInstance instance) { service.save(ring.getName(), instance); URI location = UriBuilder.fromPath("{id}").build(instance.getId()); return Response.created(location).build(); } @Inject  CassandraInstanceResource(CassandraInstanceService service, @Assisted CassandraRing ring); @GET Set<CassandraInstance> findAll(); @POST Response createInstance(@Valid CassandraInstance instance); @GET @Path("{id}") CassandraInstance findById(@PathParam("id") int id); @DELETE @Path("{id}") Response deleteInstance(@PathParam("id") int id);  }### Answer:
@Test public void createInstance() { CassandraInstance instance = createMock(CassandraInstance.class); service.save(RING_NAME, instance); expect(instance.getId()).andReturn(CASSANDRA_ID); replayAll(); Response response = resource.createInstance(instance); assertEquals(Status.CREATED.getStatusCode(), response.getStatus()); assertEquals(String.valueOf(CASSANDRA_ID), response.getMetadata().getFirst(HttpHeaders.LOCATION).toString()); }