@Test
void copyWhenWikiAlreadyExists() throws Exception
{
when(this.store.isWikiNameAvailable(any(String.class), any(XWikiContext.class))).thenReturn(true);
when(this.wikiDescriptorManager.exists("existingid")).thenReturn(true);
Throwable exception = assertThrows(WikiManagerException.class, () -> {
this.wikiManager.copy("wikiid", "existingid", "newwikialias", true, true, true);
});
assertEquals("The wiki id [existingid] is already used or is a reserved id, and thus is not available.",
exception.getMessage());
}