ShardDataModification extends WriteableNodeWithSubshard { @Override public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) { return new WritableNodeOperation(this, rootContext.cursor()) { @Override public void exit() { throw new IllegalStateException("Can not exit data tree root"); } }; } ShardDataModification(final ShardRootModificationContext boundary,
                          final Map<PathArgument, WriteableModificationNode> subshards,
                          final Map<DOMDataTreeIdentifier, ForeignShardModificationContext> childShards); @Override WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor); @Override PathArgument getIdentifier();  }
@Test(expected = IllegalStateException.class) public void createWithException() throws Exception { final DataTreeModificationCursor dataTreeModificationCursor = mock(DataTreeModificationCursor.class); final DataTreeModificationCursorAdaptor dataTreeModificationCursorAdaptor = DataTreeModificationCursorAdaptor.of(dataTreeModificationCursor); doReturn(dataTreeModificationCursorAdaptor).when(SHARD_ROOT_MODIFICATION_CONTEXT).cursor(); shardDataModification.createOperation(null).exit(); }