Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaƫl Barbero2013-06-23 17:16:25 -0400
committerAxel Richard2013-07-16 04:56:24 -0400
commit51c49e147dbd1113ac4c9ec22a4d735a4cb0f580 (patch)
treef4b035fdc0cb2bb5ea17b7d8415c8dddf62d51b8 /plugins/org.eclipse.emf.compare.tests/src/org/eclipse
parentba590393675ff110a533ebd23eef897b6b23b7e0 (diff)
downloadorg.eclipse.emf.compare-51c49e147dbd1113ac4c9ec22a4d735a4cb0f580.tar.gz
org.eclipse.emf.compare-51c49e147dbd1113ac4c9ec22a4d735a4cb0f580.tar.xz
org.eclipse.emf.compare-51c49e147dbd1113ac4c9ec22a4d735a4cb0f580.zip
Refactor Groups.
-IDifferenceGroup are now Adapters. -Use TreeNode as new ItemProviders instead of EDiffNodes. -Add a new Group: By Resource. Change-Id: I26b451997ce42ce37cee266bb0d9e80c07287984
Diffstat (limited to 'plugins/org.eclipse.emf.compare.tests/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestComparisonItemProviderSpec.java108
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestMatchItemProviderSpec.java40
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestReferenceChangeItemProviderSpec.java157
3 files changed, 104 insertions, 201 deletions
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestComparisonItemProviderSpec.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestComparisonItemProviderSpec.java
index 1ba8f54cf..a51c1e9c1 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestComparisonItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestComparisonItemProviderSpec.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2012 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.tests.edit;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.size;
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.MatchResource;
-import org.eclipse.emf.compare.provider.ComparisonItemProvider;
-import org.eclipse.emf.compare.provider.spec.ComparisonItemProviderSpec;
-import org.eclipse.emf.compare.tests.edit.data.ecore.a1.EcoreA1InputData;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public class TestComparisonItemProviderSpec extends AbstractTestCompareItemProviderAdapter {
-
- private ComparisonItemProvider itemProvider;
-
- @Override
- @Before
- public void before() throws IOException {
- super.before();
- itemProvider = (ComparisonItemProviderSpec)compareItemProviderAdapterFactory
- .createComparisonAdapter();
- }
-
- @Test
- public void testGetChildren_EcoreA1() throws IOException {
- Comparison comparison = getComparison(new EcoreA1InputData());
-
- Collection<?> children = itemProvider.getChildren(comparison);
-
- assertEquals(2, children.size());
- assertEquals(1, size(filter(children, Match.class)));
- assertEquals(1, size(filter(children, MatchResource.class)));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.edit;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.size;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.compare.provider.ComparisonItemProvider;
+import org.eclipse.emf.compare.provider.spec.ComparisonItemProviderSpec;
+import org.eclipse.emf.compare.tests.edit.data.ecore.a1.EcoreA1InputData;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public class TestComparisonItemProviderSpec extends AbstractTestCompareItemProviderAdapter {
+
+ private ComparisonItemProvider itemProvider;
+
+ @Override
+ @Before
+ public void before() throws IOException {
+ super.before();
+ itemProvider = (ComparisonItemProviderSpec)compareItemProviderAdapterFactory
+ .createComparisonAdapter();
+ }
+
+ @Test
+ public void testGetChildren_EcoreA1() throws IOException {
+ Comparison comparison = getComparison(new EcoreA1InputData());
+
+ Collection<?> children = itemProvider.getChildren(comparison);
+
+ assertEquals(7, children.size());
+ assertEquals(1, size(filter(children, Match.class)));
+ assertEquals(1, size(filter(children, MatchResource.class)));
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestMatchItemProviderSpec.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestMatchItemProviderSpec.java
index d351bcf21..8a1363e8a 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestMatchItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestMatchItemProviderSpec.java
@@ -46,9 +46,9 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackageMatchChildren = itemProvider.getChildren(ePackageMatch);
- assertEquals(18, ePackageMatchChildren.size());
+ assertEquals(22, ePackageMatchChildren.size());
assertEquals(4, size(filter(ePackageMatchChildren, Diff.class)));
- assertEquals(14, size(filter(ePackageMatchChildren, Match.class)));
+ assertEquals(18, size(filter(ePackageMatchChildren, Match.class)));
}
static Match getEcoreA1_EPackageMatch() throws IOException {
@@ -64,13 +64,13 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackage_MatchChildren = itemProvider.getChildren(ePackageMatch);
- Match audioVisualItem_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name",
- "AudioVisualItem");
+ Match audioVisualItem_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", //$NON-NLS-1$
+ "AudioVisualItem"); //$NON-NLS-1$
Collection<?> audioVisualItem_MatchChildren = itemProvider.getChildren(audioVisualItem_Match);
- assertEquals(4, audioVisualItem_MatchChildren.size());
+ assertEquals(5, audioVisualItem_MatchChildren.size());
assertEquals(2, size(filter(audioVisualItem_MatchChildren, Diff.class)));
- assertEquals(2, size(filter(audioVisualItem_MatchChildren, Match.class)));
+ assertEquals(3, size(filter(audioVisualItem_MatchChildren, Match.class)));
}
@Test
@@ -78,11 +78,11 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackage_MatchChildren = itemProvider.getChildren(ePackageMatch);
- Match audioVisualItem_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name",
- "AudioVisualItem");
+ Match audioVisualItem_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", //$NON-NLS-1$
+ "AudioVisualItem"); //$NON-NLS-1$
Collection<?> audioVisualItem_MatchChildren = itemProvider.getChildren(audioVisualItem_Match);
- Match audioVisualItem_legnth_Match = getMatchWithFeatureValue(audioVisualItem_MatchChildren, "name",
- "length");
+ Match audioVisualItem_legnth_Match = getMatchWithFeatureValue(audioVisualItem_MatchChildren, "name", //$NON-NLS-1$
+ "length"); //$NON-NLS-1$
Collection<?> audioVisualItem_legnth_MatchChildren = itemProvider
.getChildren(audioVisualItem_legnth_Match);
@@ -96,12 +96,12 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackage_MatchChildren = itemProvider.getChildren(ePackageMatch);
- Match book_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Book");
+ Match book_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Book"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> book_MatchChildren = itemProvider.getChildren(book_Match);
- assertEquals(6, book_MatchChildren.size());
+ assertEquals(8, book_MatchChildren.size());
assertEquals(3, size(filter(book_MatchChildren, Diff.class)));
- assertEquals(3, size(filter(book_MatchChildren, Match.class)));
+ assertEquals(5, size(filter(book_MatchChildren, Match.class)));
}
@Test
@@ -109,12 +109,12 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackage_MatchChildren = itemProvider.getChildren(ePackageMatch);
- Match bookCategory_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "BookCategory");
+ Match bookCategory_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "BookCategory"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> bookCategory_MatchChildren = itemProvider.getChildren(bookCategory_Match);
- assertEquals(7, bookCategory_MatchChildren.size());
+ assertEquals(11, bookCategory_MatchChildren.size());
assertEquals(4, size(filter(bookCategory_MatchChildren, Diff.class)));
- assertEquals(3, size(filter(bookCategory_MatchChildren, Match.class)));
+ assertEquals(7, size(filter(bookCategory_MatchChildren, Match.class)));
}
@Test
@@ -122,7 +122,7 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackage_MatchChildren = itemProvider.getChildren(ePackageMatch);
- Match borrowable_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Borrowable");
+ Match borrowable_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Borrowable"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> borrowable_MatchChildren = itemProvider.getChildren(borrowable_Match);
assertEquals(3, borrowable_MatchChildren.size());
@@ -135,11 +135,11 @@ public class TestMatchItemProviderSpec extends AbstractTestCompareItemProviderAd
Match ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackage_MatchChildren = itemProvider.getChildren(ePackageMatch);
- Match person_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Person");
+ Match person_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Person"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> person_MatchChildren = itemProvider.getChildren(person_Match);
- assertEquals(3, person_MatchChildren.size());
+ assertEquals(6, person_MatchChildren.size());
assertEquals(3, size(filter(person_MatchChildren, Diff.class)));
- assertEquals(0, size(filter(person_MatchChildren, Match.class)));
+ assertEquals(3, size(filter(person_MatchChildren, Match.class)));
}
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestReferenceChangeItemProviderSpec.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestReferenceChangeItemProviderSpec.java
index 2d32db3c3..603ee6dce 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestReferenceChangeItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/edit/TestReferenceChangeItemProviderSpec.java
@@ -11,20 +11,15 @@
package org.eclipse.emf.compare.tests.edit;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.get;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EcorePackage;
import org.junit.Test;
/**
@@ -38,27 +33,18 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> ePackage_MatchChildren = adaptAsITreeItemContentProvider(ePackageMatch).getChildren(
ePackageMatch);
- Match audioVisualItem_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name",
- "AudioVisualItem");
+ Match audioVisualItem_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", //$NON-NLS-1$
+ "AudioVisualItem"); //$NON-NLS-1$
Collection<?> audioVisualItem_MatchChildren = adaptAsITreeItemContentProvider(audioVisualItem_Match)
.getChildren(audioVisualItem_Match);
ReferenceChange titleReferenceChange = getReferenceChangeWithFeatureValue(
- audioVisualItem_MatchChildren, "name", "title");
+ audioVisualItem_MatchChildren, "name", "title"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> titleReferenceChange_Children = adaptAsITreeItemContentProvider(titleReferenceChange)
.getChildren(titleReferenceChange);
- assertEquals(1, titleReferenceChange_Children.size());
- Object child = get(titleReferenceChange_Children, 0);
- assertTrue(child instanceof ReferenceChange);
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, ((ReferenceChange)child).getReference());
-
- ReferenceChange titledItemReferenceChange = getReferenceChangeWithFeatureValue(
- audioVisualItem_MatchChildren, "name", "TitledItem");
- Collection<?> titledItemReferenceChange_Children = adaptAsITreeItemContentProvider(
- titledItemReferenceChange).getChildren(titledItemReferenceChange);
- assertEquals(0, titledItemReferenceChange_Children.size());
+ assertEquals(0, titleReferenceChange_Children.size());
}
@Test
@@ -67,36 +53,17 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> ePackage_MatchChildren = adaptAsITreeItemContentProvider(ePackageMatch).getChildren(
ePackageMatch);
- Match book_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Book");
- Collection<?> book_MatchChildren = adaptAsITreeItemContentProvider(book_Match).getChildren(book_Match);
+ Match book_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Book"); //$NON-NLS-1$ //$NON-NLS-2$
+ Collection<?> book_MatchChildren = adaptAsITreeItemContentProvider(book_Match)
+ .getChildren(book_Match);
ReferenceChange subtitleReferenceChange = getReferenceChangeWithFeatureValue(book_MatchChildren,
- "name", "subtitle");
+ "name", "subtitle"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> subtitleReferenceChange_Children = adaptAsITreeItemContentProvider(
subtitleReferenceChange).getChildren(subtitleReferenceChange);
- assertEquals(1, subtitleReferenceChange_Children.size());
- Notifier child = (Notifier)get(subtitleReferenceChange_Children, 0);
- assertTrue(child instanceof ReferenceChange);
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, ((ReferenceChange)child).getReference());
- assertTrue(adaptAsITreeItemContentProvider(child).getChildren(child).isEmpty());
-
- ReferenceChange titleReferenceChange = getReferenceChangeWithFeatureValue(book_MatchChildren, "name",
- "title");
- Collection<?> titleReferenceChange_Children = adaptAsITreeItemContentProvider(titleReferenceChange)
- .getChildren(titleReferenceChange);
- assertEquals(1, titleReferenceChange_Children.size());
- child = (Notifier)get(titleReferenceChange_Children, 0);
- assertTrue(child instanceof ReferenceChange);
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, ((ReferenceChange)child).getReference());
- assertTrue(adaptAsITreeItemContentProvider(child).getChildren(child).isEmpty());
-
- ReferenceChange titledItemReferenceChange = getReferenceChangeWithFeatureValue(book_MatchChildren,
- "name", "TitledItem");
- Collection<?> titledItemReferenceChange_Children = adaptAsITreeItemContentProvider(
- titledItemReferenceChange).getChildren(titledItemReferenceChange);
- assertEquals(0, titledItemReferenceChange_Children.size());
+ assertEquals(0, subtitleReferenceChange_Children.size());
}
@Test
@@ -105,8 +72,8 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> ePackage_MatchChildren = adaptAsITreeItemContentProvider(ePackageMatch).getChildren(
ePackageMatch);
- Match borrowableCategory_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name",
- "Borrowable");
+ Match borrowableCategory_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", //$NON-NLS-1$
+ "Borrowable"); //$NON-NLS-1$
Collection<?> borrowable_MatchChildren = adaptAsITreeItemContentProvider(borrowableCategory_Match)
.getChildren(borrowableCategory_Match);
@@ -119,18 +86,18 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> ePackage_MatchChildren = adaptAsITreeItemContentProvider(ePackageMatch).getChildren(
ePackageMatch);
- Match bookCategory_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "BookCategory");
+ Match bookCategory_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "BookCategory"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> bookCategory_MatchChildren = adaptAsITreeItemContentProvider(bookCategory_Match)
.getChildren(bookCategory_Match);
ReferenceChange dictionaryReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildren, "name", "Dictionary");
+ bookCategory_MatchChildren, "name", "Dictionary"); //$NON-NLS-1$ //$NON-NLS-2$
ReferenceChange encyclopediaReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildren, "name", "Encyclopedia");
+ bookCategory_MatchChildren, "name", "Encyclopedia"); //$NON-NLS-1$ //$NON-NLS-2$
ReferenceChange mangaReferenceChange = getReferenceChangeWithFeatureValue(bookCategory_MatchChildren,
- "name", "Manga");
+ "name", "Manga"); //$NON-NLS-1$ //$NON-NLS-2$
ReferenceChange manhwaReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildren, "name", "Manhwa");
+ bookCategory_MatchChildren, "name", "Manhwa"); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(adaptAsITreeItemContentProvider(dictionaryReferenceChange).getChildren(
dictionaryReferenceChange).isEmpty());
@@ -152,28 +119,14 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> magazineChildren = null;
for (ReferenceChange referenceChange : filter(ePackage_MatchChildren, ReferenceChange.class)) {
EClass eClass = (EClass)referenceChange.getValue();
- if ("Magazine".equals(eClass.getName())
- && "CirculatingItem".equals(eClass.getESuperTypes().get(0).getName())) {
+ if ("Magazine".equals(eClass.getName()) //$NON-NLS-1$
+ && "CirculatingItem".equals(eClass.getESuperTypes().get(0).getName())) { //$NON-NLS-1$
magazineChildren = adaptAsITreeItemContentProvider(referenceChange).getChildren(
referenceChange);
- assertEquals(3, magazineChildren.size());
+ assertEquals(0, magazineChildren.size());
break;
}
}
- ReferenceChange magazineSuperTypeChange = getReferenceChangeWithFeatureValue(magazineChildren,
- "name", "CirculatingItem");
- assertTrue(adaptAsITreeItemContentProvider(magazineSuperTypeChange).getChildren(
- magazineSuperTypeChange).isEmpty());
-
- ReferenceChange magazineSFChange1 = getReferenceChangeWithFeatureValue(magazineChildren, "name",
- "pages");
- assertEquals(1, adaptAsITreeItemContentProvider(magazineSFChange1).getChildren(magazineSFChange1)
- .size());
-
- ReferenceChange magazineSFChange2 = getReferenceChangeWithFeatureValue(magazineChildren, "name",
- "title");
- assertEquals(1, adaptAsITreeItemContentProvider(magazineSFChange2).getChildren(magazineSFChange2)
- .size());
}
@Test
@@ -186,18 +139,14 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> magazineChildren = null;
for (ReferenceChange referenceChange : filter(ePackage_MatchChildren, ReferenceChange.class)) {
EClass eClass = (EClass)referenceChange.getValue();
- if ("Magazine".equals(eClass.getName())
- && "Periodical".equals(eClass.getESuperTypes().get(0).getName())) {
+ if ("Magazine".equals(eClass.getName()) //$NON-NLS-1$
+ && "Periodical".equals(eClass.getESuperTypes().get(0).getName())) { //$NON-NLS-1$
magazineChildren = adaptAsITreeItemContentProvider(referenceChange).getChildren(
referenceChange);
- assertEquals(1, magazineChildren.size());
+ assertEquals(0, magazineChildren.size());
break;
}
}
- ReferenceChange magazineSuperTypeChange = getReferenceChangeWithFeatureValue(magazineChildren,
- "name", "Periodical");
- assertTrue(adaptAsITreeItemContentProvider(magazineSuperTypeChange).getChildren(
- magazineSuperTypeChange).isEmpty());
}
@Test
@@ -207,28 +156,11 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> ePackage_MatchChildren = adaptAsITreeItemContentProvider(ePackageMatch).getChildren(
ePackageMatch);
ReferenceChange periodical_ReferenceChange = getReferenceChangeWithFeatureValue(
- ePackage_MatchChildren, "name", "Periodical");
+ ePackage_MatchChildren, "name", "Periodical"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> periodical_ReferenceChangeChildren = adaptAsITreeItemContentProvider(
periodical_ReferenceChange).getChildren(periodical_ReferenceChange);
- assertEquals(5, periodical_ReferenceChangeChildren.size());
-
- ReferenceChange issuesPerYearChange = getReferenceChangeWithFeatureValue(
- periodical_ReferenceChangeChildren, "name", "issuesPerYear");
-
- ReferenceChange itemChange = getReferenceChangeWithFeatureValue(periodical_ReferenceChangeChildren,
- "name", "Item");
- ReferenceChange titledItemChange = getReferenceChangeWithFeatureValue(
- periodical_ReferenceChangeChildren, "name", "TitledItem");
-
- Collection<?> issuesPerYearChildren = adaptAsITreeItemContentProvider(issuesPerYearChange)
- .getChildren(issuesPerYearChange);
- assertEquals(1, issuesPerYearChildren.size());
- ReferenceChange issuePerYearChild = (ReferenceChange)issuesPerYearChildren.iterator().next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, issuePerYearChild.getReference());
-
- assertTrue(adaptAsITreeItemContentProvider(itemChange).getChildren(itemChange).isEmpty());
- assertTrue(adaptAsITreeItemContentProvider(titledItemChange).getChildren(titledItemChange).isEmpty());
+ assertEquals(0, periodical_ReferenceChangeChildren.size());
}
@Test
@@ -237,38 +169,17 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
Collection<?> ePackage_MatchChildren = adaptAsITreeItemContentProvider(ePackageMatch).getChildren(
ePackageMatch);
- Match person_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Person");
+ Match person_Match = getMatchWithFeatureValue(ePackage_MatchChildren, "name", "Person"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> person_MatchChildren = adaptAsITreeItemContentProvider(person_Match).getChildren(
person_Match);
- assertEquals(3, person_MatchChildren.size());
+ assertEquals(6, person_MatchChildren.size());
ReferenceChange issuesPerYearChange = getReferenceChangeWithFeatureValue(person_MatchChildren,
- "name", "firstName");
+ "name", "firstName"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> firstNameChildren = adaptAsITreeItemContentProvider(issuesPerYearChange).getChildren(
issuesPerYearChange);
- assertEquals(1, firstNameChildren.size());
- ReferenceChange firstNameChild = (ReferenceChange)firstNameChildren.iterator().next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, firstNameChild.getReference());
-
- ReferenceChange fullNameChange = getReferenceChangeWithFeatureValue(person_MatchChildren, "name",
- "fullName");
- Collection<?> fullNameChildren = adaptAsITreeItemContentProvider(fullNameChange).getChildren(
- fullNameChange);
- assertEquals(1, fullNameChildren.size());
- ReferenceChange fullNameChild = (ReferenceChange)fullNameChildren.iterator().next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, fullNameChild.getReference());
-
- ReferenceChange lastNameChange = getReferenceChangeWithFeatureValue(person_MatchChildren, "name",
- "lastName");
- Collection<?> lastNameChildren = adaptAsITreeItemContentProvider(lastNameChange).getChildren(
- lastNameChange);
- assertEquals(2, lastNameChildren.size());
- Iterator<?> lastNameiterator = lastNameChildren.iterator();
- ReferenceChange lastName1stChild = (ReferenceChange)lastNameiterator.next();
- AttributeChange lastName2ndChild = (AttributeChange)lastNameiterator.next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, lastName1stChild.getReference());
- assertEquals(EcorePackage.Literals.ENAMED_ELEMENT__NAME, lastName2ndChild.getAttribute());
+ assertEquals(0, firstNameChildren.size());
}
@Test
@@ -279,17 +190,9 @@ public class TestReferenceChangeItemProviderSpec extends AbstractTestCompareItem
ePackageMatch);
ReferenceChange titledItem_ReferenceChange = getReferenceChangeWithFeatureValue(
- ePackage_MatchChildren, "name", "TitledItem");
+ ePackage_MatchChildren, "name", "TitledItem"); //$NON-NLS-1$ //$NON-NLS-2$
Collection<?> titledItem_ReferenceChangeChildren = adaptAsITreeItemContentProvider(
titledItem_ReferenceChange).getChildren(titledItem_ReferenceChange);
- assertEquals(1, titledItem_ReferenceChangeChildren.size());
-
- ReferenceChange title_Change = (ReferenceChange)titledItem_ReferenceChangeChildren.iterator().next();
- Collection<?> title_ChangeChildren = adaptAsITreeItemContentProvider(title_Change).getChildren(
- title_Change);
- assertEquals(1, title_ChangeChildren.size());
-
- ReferenceChange eType_Change = (ReferenceChange)title_ChangeChildren.iterator().next();
- assertTrue(adaptAsITreeItemContentProvider(eType_Change).getChildren(eType_Change).isEmpty());
+ assertEquals(0, titledItem_ReferenceChangeChildren.size());
}
}

Back to the top