Commit 585796ba authored by Florine Boudin's avatar Florine Boudin
Browse files

BS-11314 Add test on the migrationBefore

parent 55812c74
......@@ -78,6 +78,7 @@ public class FileWidgetDocumentMigrationTest {
operationInstance.set("operator", operatorInstance);
fileWidgetInstance.set("action", operationInstance);
fileWidgetInstance.set("document", documentInstance);
final EList<Instance> fileWidgetList = new BasicEList<Instance>();
fileWidgetList.add(fileWidgetInstance);
......@@ -117,4 +118,12 @@ public class FileWidgetDocumentMigrationTest {
verify(leftOperandInstance).add("referencedElements", documentInstance.copy());
}
@Test
public void should_migrateBefore_RemoveExistingDocumentAttributeInFileWidget() throws Exception {
when(fileWidgetInstance.get("document")).thenReturn(documentInstance);
migrationUnderTest.migrateBefore(model, metamodel);
verify(fileWidgetInstance).remove("document", documentInstance);
}
}
......@@ -33,11 +33,12 @@ import org.eclipse.emf.edapt.migration.Model;
public class FileWidgetDocumentMigration extends CustomMigration {
private EList<Instance> documents;
private EList<Instance> fileWidgets;
@Override
public void migrateBefore(final Model model, final Metamodel metamodel) throws MigrationException {
super.migrateBefore(model, metamodel);
final EList<Instance> fileWidgets = model.getAllInstances("form.FileWidget");
fileWidgets = model.getAllInstances("form.FileWidget");
// remove old documents
for (final Instance fileWidget : fileWidgets) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment