Search in sources :

Example 1 with RenameNodeParams

use of com.enonic.xp.node.RenameNodeParams in project xp by enonic.

the class MoveNodeHandlerTest method mockGetNode.

private void mockGetNode() {
    Mockito.when(this.nodeService.getById(NodeId.from("nodeId"))).thenReturn(createNode());
    Mockito.when(this.nodeService.getByPath(NodePath.create("/my-name").build())).thenReturn(createNode());
    Mockito.when(this.nodeService.rename(Mockito.any())).thenAnswer(invocation -> {
        final RenameNodeParams renameNodeParams = (RenameNodeParams) invocation.getArguments()[0];
        name = renameNodeParams.getNewNodeName().toString();
        return createNode();
    });
    Mockito.when(this.nodeService.move(Mockito.any(NodeId.class), Mockito.any(), Mockito.any())).thenAnswer(invocation -> {
        parentPath = ((NodePath) invocation.getArguments()[1]).trimTrailingDivider();
        return createNode();
    });
}
Also used : RenameNodeParams(com.enonic.xp.node.RenameNodeParams) NodeId(com.enonic.xp.node.NodeId)

Aggregations

NodeId (com.enonic.xp.node.NodeId)1 RenameNodeParams (com.enonic.xp.node.RenameNodeParams)1