* Tests the {@link com.volantis.mcs.eclipse.ab.editors.dom.ODOMEditorContext#addRootElement} method.
* @throws Throwable if an error occurs.
*/
public void testAddRootElement() throws Throwable {
// create a root element
final ODOMElement root = createRootElement();
final IResource resource = createResource();
ODOMEditorContextManager manager = new ODOMEditorContextManager(
new ODOMEditorContextCreator() {
public ODOMEditorContext create() throws Exception {
return new ODOMEditorContext(resource,
NULL_UR_MEMENTO_ORIGINATOR,
root, null);
}
});
manager.performOperation(new ODOMEditorContextOperation() {
public void perform(ODOMEditorContext context) throws Exception {
// check that the root element is the one that we are
// interested in
assertSame("rootElement is not as expected ",
root,
context.getRootElement());
context.removeRootElement(root);
// provide a new root element
ODOMElement newRoot = createRootElement();
// set the new root on the context
context.addRootElement(newRoot, null);
// check that the root element is the one that we are
// interested in
assertSame("new rootElement is not as expected ",