@Test public void findByName_notFound() throws Exception { expect(service.findByName(RING_NAME)).andReturn(null); replayAll(); try { resource.findByName(RING_NAME); fail("Expected NotFoundException"); } catch (NotFoundException e) { assertEquals(Status.NOT_FOUND.getStatusCode(), e.getResponse().getStatus()); assertEquals("No ring found with name: " + RING_NAME, e.getResponse().getEntity()); } }
@GET @Path("{name}") public CassandraRing findByName(@PathParam("name") String name) { return getByNameIfFound(name); }
CassandraRingResource { @GET @Path("{name}") public CassandraRing findByName(@PathParam("name") String name) { return getByNameIfFound(name); } }
CassandraRingResource { @GET @Path("{name}") public CassandraRing findByName(@PathParam("name") String name) { return getByNameIfFound(name); } @Inject  CassandraRingResource(CassandraRingService service,
      CassandraInstanceResourceFactory instanceResourceFactory,
      SeedResourceFactory seedResourceFactory); }
CassandraRingResource { @GET @Path("{name}") public CassandraRing findByName(@PathParam("name") String name) { return getByNameIfFound(name); } @Inject  CassandraRingResource(CassandraRingService service,
      CassandraInstanceResourceFactory instanceResourceFactory,
      SeedResourceFactory seedResourceFactory); @GET Set<CassandraRing> findAll(); @POST Response createRing(@Valid CassandraRing ring); @GET @Path("{name}") CassandraRing findByName(@PathParam("name") String name); @DELETE @Path("{name}") Response deleteRing(@PathParam("name") String name); @Path("{name}/instances") CassandraInstanceResource getCassandraInstanceResource(@PathParam("name") String name); @Path("{name}/seeds") SeedResource getSeedResource(@PathParam("name") String name); }
CassandraRingResource { @GET @Path("{name}") public CassandraRing findByName(@PathParam("name") String name) { return getByNameIfFound(name); } @Inject  CassandraRingResource(CassandraRingService service,
      CassandraInstanceResourceFactory instanceResourceFactory,
      SeedResourceFactory seedResourceFactory); @GET Set<CassandraRing> findAll(); @POST Response createRing(@Valid CassandraRing ring); @GET @Path("{name}") CassandraRing findByName(@PathParam("name") String name); @DELETE @Path("{name}") Response deleteRing(@PathParam("name") String name); @Path("{name}/instances") CassandraInstanceResource getCassandraInstanceResource(@PathParam("name") String name); @Path("{name}/seeds") SeedResource getSeedResource(@PathParam("name") String name);  }