@Test
public void should_not_save_an_external_asset_when_upload_send_an_error() throws Exception {

    Page page = mockPageOfId("my-page");
    Asset asset = anAsset().build();
    doThrow(IllegalArgumentException.class).when(pageAssetService).save(page, asset);
    mockMvc.perform(
            post("/rest/pages/my-page/assets")
                    .contentType(MediaType.APPLICATION_JSON_VALUE)
                    .content(convertObjectToJsonBytes(asset)))
            .andExpect(status().isBadRequest());
}