@Test public void updateItemShouldReturnNotSupportedMediaTypeIfNonJSON() { given() .body(FIRST_ITEM) .when() .put(ITEM_RESOURCE, firstItem.getId()) .then() .statusCode(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE); }
@Test public void updateItemShouldReturnUpdatedItem() { // Given an unchecked first item Item item = new ItemBuilder().description(FIRST_ITEM_DESCRIPTION).build(); given() .body(item) .contentType(ContentType.JSON) .when() .put(ITEM_RESOURCE, firstItem.getId()) .then() .statusCode(HttpStatus.SC_OK) .body(DESCRIPTION_FIELD, is(FIRST_ITEM_DESCRIPTION)) .body(CHECKED_FIELD, is(false)); }
@Test public void deleteItemShouldReturnNoContent() { when().delete(ITEM_RESOURCE, secondItem.getId()).then().statusCode(HttpStatus.SC_NO_CONTENT); }
@Test public void updateItemShouldReturnBadRequestWithoutBody() { when().put(ITEM_RESOURCE, firstItem.getId()).then().statusCode(HttpStatus.SC_BAD_REQUEST); }