/** Set reference to filled list. */ @Test public void setValueToFilledTest() { new EMFStoreCommand() { @Override protected void doRun() { element = createTestElementWithoutTransaction(); oldValue = createTestElementWithoutTransaction(); newValue = createTestElementWithoutTransaction(); element.getReferences().add(oldValue); clearOperations(); } }.run(false); assertTrue(element.getReferences().size() == 1); assertTrue(element.getReferences().get(0).equals(oldValue)); new EMFStoreCommand() { @Override protected void doRun() { element.getReferences().set(0, newValue); } }.run(false); assertTrue(element.getReferences().size() == 1); assertTrue(element.getReferences().get(0).equals(newValue)); assertTrue(getProjectSpace().getOperations().size() == 1); assertTrue(getProjectSpace().getOperations().get(0) instanceof MultiReferenceSetOperation); }
/** Set and reverse operation. */ @Test public void setAndReverseTest() { new EMFStoreCommand() { @Override protected void doRun() { element = createTestElementWithoutTransaction(); oldValue = createTestElementWithoutTransaction(); element.getReferences().add(oldValue); newValue = createTestElementWithoutTransaction(); clearOperations(); assertTrue(element.getReferences().size() == 1); assertTrue(element.getReferences().get(0).equals(oldValue)); } }.run(false); new EMFStoreCommand() { @Override protected void doRun() { element.getReferences().set(0, newValue); } }.run(false); assertTrue(element.getReferences().size() == 1); assertTrue(element.getReferences().get(0).equals(newValue)); new EMFStoreCommand() { @Override protected void doRun() { AbstractOperation operation = getProjectSpace().getOperations().get(0).reverse(); operation.apply(getProject()); } }.run(false); assertTrue(element.getReferences().size() == 1); assertTrue(element.getReferences().get(0).equals(oldValue)); }