@Test public void findById_notFound() throws Exception { expect(service.findById(RING_NAME, CASSANDRA_ID)).andReturn(null); replayAll(); try { resource.findById(CASSANDRA_ID); fail("Expected NotFoundException"); } catch (NotFoundException e) { assertEquals(Status.NOT_FOUND.getStatusCode(), e.getResponse().getStatus()); assertEquals("No instance found with id: " + CASSANDRA_ID, e.getResponse().getEntity()); } }
@GET @Path("{id}") public CassandraInstance findById(@PathParam("id") int id) { return getByIdIfFound(id); }
CassandraInstanceResource { @GET @Path("{id}") public CassandraInstance findById(@PathParam("id") int id) { return getByIdIfFound(id); } }
CassandraInstanceResource { @GET @Path("{id}") public CassandraInstance findById(@PathParam("id") int id) { return getByIdIfFound(id); } @Inject  CassandraInstanceResource(CassandraInstanceService service, @Assisted CassandraRing ring); }
CassandraInstanceResource { @GET @Path("{id}") public CassandraInstance findById(@PathParam("id") int id) { return getByIdIfFound(id); } @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); }
CassandraInstanceResource { @GET @Path("{id}") public CassandraInstance findById(@PathParam("id") int id) { return getByIdIfFound(id); } @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);  }