@Test
public void should_return_error_when_uploading_with_error_onsave() throws Exception {

    expectedException.expect(RepositoryException.class);
    expectedException.expectMessage(is("Error while saving internal asset"));
    Page page = aPage().build();
    MockMultipartFile file = new MockMultipartFile("file.js", "myfile.inv", "application/javascript", "function(){}".getBytes());
    doThrow(IOException.class).when(repository).updateLastUpdateAndSave(page);
    assetService.upload(file, page, "js");
}