Skip to content

Commit

Permalink
fix view test for UUID resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wittler committed Dec 13, 2022
1 parent 54df23b commit 3107261
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@

import allElementTypes.NonRoot;
import allElementTypes.Root;
import tools.vitruv.change.atomic.EChange;
import tools.vitruv.change.atomic.eobject.EobjectPackage;
import tools.vitruv.change.atomic.feature.attribute.ReplaceSingleValuedEAttribute;
import tools.vitruv.change.atomic.resolve.EChangeResolverAndApplicator;
import tools.vitruv.change.atomic.root.InsertRootEObject;
import tools.vitruv.change.atomic.root.RootFactory;
import tools.vitruv.change.atomic.root.RootPackage;
import tools.vitruv.change.atomic.uuid.UuidResolver;
import tools.vitruv.change.composite.description.VitruviusChange;
import tools.vitruv.framework.views.ChangeableViewSource;
import tools.vitruv.framework.views.ModifiableViewSelection;
Expand All @@ -47,6 +50,8 @@ public class ChangeDerivingViewTest {
ChangeableViewSource mockChangeableViewSource;
@Mock
ModifiableViewSelection mockViewSelection;
@Mock
UuidResolver uuidResolver;

@BeforeEach
public void initializeMocks() {
Expand Down Expand Up @@ -209,6 +214,10 @@ public void commitChanges() throws Exception {
InsertRootEObject<EObject> expectedChange = RootFactory.eINSTANCE.createInsertRootEObject();
expectedChange.setNewValue(root);
expectedChange.setUri(testResourceUriString);
// validation expects the change to represent the new state, thus apply it
for (EChange change : argument.getValue().getEChanges()) {
EChangeResolverAndApplicator.applyForward(change, uuidResolver);
}
assertThat(argument.getValue().getEChanges().size(), is(3)); // Create, Insert, ReplaceId
assertThat(argument.getValue().getEChanges().get(1),
equalsDeeply(expectedChange,
Expand Down

0 comments on commit 3107261

Please sign in to comment.