@Test
public void should_create_a_page_from_a_Page() throws Exception {

    Page pageToBeSaved = aPage().withId("my-page").build();
    List<Element> emptyRow = Collections.emptyList();
    List<List<Element>> rows = Collections.singletonList(emptyRow);
    pageToBeSaved.setRows(rows);
    pageToBeSaved.setName("test");
    when(pageRepository.getNextAvailableId("test")).thenReturn("test");
    mockMvc
            .perform(post("/rest/pages")
                    .contentType(MediaType.APPLICATION_JSON_VALUE)
                    .content(convertObjectToJsonBytes(pageToBeSaved)))
            .andExpect(status().isCreated())
            .andExpect(jsonPath("$.id", notNullValue()));
    verify(pageRepository).updateLastUpdateAndSave(notNull(Page.class));
    verify(pageAssetService).loadDefaultAssets(any(Page.class));
}