use of com.enonic.xp.content.RenameContentParams in project xp by enonic.
the class MoveContentHandlerTest method mockRename.
private void mockRename(final ContentId contentId, final String newName, final Content contentResult) {
final RenameContentParams renameParams = RenameContentParams.create().contentId(contentId).newName(ContentName.from(newName)).build();
when(this.contentService.rename(Mockito.eq(renameParams))).thenReturn(contentResult);
}
use of com.enonic.xp.content.RenameContentParams in project xp by enonic.
the class RenameContentCommandTest method test_valid_changed.
@Test
void test_valid_changed() {
final Content content = createContent(true);
when(this.nodeService.getById(any(NodeId.class))).thenReturn(mockNode);
when(translator.fromNode(mockNode, false)).thenReturn(content);
when(translator.fromNode(mockNode, true)).thenReturn(content);
final RenameContentParams params = RenameContentParams.create().contentId(content.getId()).newName(ContentName.unnamed()).build();
createCommand(params).execute();
verify(nodeService, times(1)).update(isA(UpdateNodeParams.class));
}
use of com.enonic.xp.content.RenameContentParams in project xp by enonic.
the class RenameContentCommandTest method test_valid_not_changed.
@Test
void test_valid_not_changed() {
final Content content = createContent(false);
when(translator.fromNode(mockNode, false)).thenReturn(content);
when(translator.fromNode(mockNode, true)).thenReturn(content);
final RenameContentParams params = RenameContentParams.create().contentId(content.getId()).newName(ContentName.unnamed()).build();
createCommand(params).execute();
verify(contentService, never()).update(isA(UpdateContentParams.class));
}
use of com.enonic.xp.content.RenameContentParams in project xp by enonic.
the class RenameContentCommandTest method test_valid_not_changed_but_fiwer_errors.
@Test
void test_valid_not_changed_but_fiwer_errors() {
final Content content = createContent(false);
when(translator.fromNode(mockNode, false)).thenReturn(content);
when(translator.fromNode(mockNode, true)).thenReturn(content);
final RenameContentParams params = RenameContentParams.create().contentId(content.getId()).newName(ContentName.unnamed()).build();
createCommand(params).execute();
verify(contentService, never()).update(isA(UpdateContentParams.class));
}
use of com.enonic.xp.content.RenameContentParams in project xp by enonic.
the class MoveContentHandler method rename.
private Content rename(final ContentId sourceId, final String newName) {
final ContentName newContentName = ContentName.from(newName);
final RenameContentParams renameParams = RenameContentParams.create().contentId(sourceId).newName(newContentName).build();
return contentService.rename(renameParams);
}
Aggregations