@Test public void testGetObject() { Item item = given().accept(JSON).when().header(testHeader).get("/api/items/{id}", 1).as(Item.class); assertEquals("Item id does not match", 1, item.getId()); assertEquals("Item name does not match", "Apples", item.getName()); }
@GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered public Item get(@Desc("ID of the item to retrieve") int id) { Item item = dao.get(id); return item; }
ItemsController extends ApiController { @GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered public Item get(@Desc("ID of the item to retrieve") int id) { Item item = dao.get(id); return item; } }
ItemsController extends ApiController { @GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered public Item get(@Desc("ID of the item to retrieve") int id) { Item item = dao.get(id); return item; }  }
ItemsController extends ApiController { @GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered public Item get(@Desc("ID of the item to retrieve") int id) { Item item = dao.get(id); return item; }  @GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered Item get(@Desc("ID of the item to retrieve") int id); }
ItemsController extends ApiController { @GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered public Item get(@Desc("ID of the item to retrieve") int id) { Item item = dao.get(id); return item; }  @GET("/{id: [0-9]+}") @ApiSummary("Get an item by id") @Return(code = 200, description = "Successful operation", onResult = Item.class) @Return(code = 404, description = "Item not found") @Metered Item get(@Desc("ID of the item to retrieve") int id);  }