summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Eysholdt2011-10-30 15:01:09 (EDT)
committerEd Merks2011-10-30 15:01:09 (EDT)
commita56b501becb178e65645f090191ba2abf95ce3c4 (patch)
tree0694681460b8c24b454924f827e49325be267161
parent96a6c200493cbe40e3edb9fec8f5d3210369a89a (diff)
downloadorg.eclipse.emf-a56b501becb178e65645f090191ba2abf95ce3c4.zip
org.eclipse.emf-a56b501becb178e65645f090191ba2abf95ce3c4.tar.gz
org.eclipse.emf-a56b501becb178e65645f090191ba2abf95ce3c4.tar.bz2
migrated tests
-rw-r--r--org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/ecore/XcoreEcoreTest.java23
-rw-r--r--org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/genmodel/XcoreGenModelTest.java27
-rw-r--r--org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/XcoreScopingTest.java27
-rw-r--r--org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/validation/XcoreValidationTest.java8
4 files changed, 33 insertions, 52 deletions
diff --git a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/ecore/XcoreEcoreTest.java b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/ecore/XcoreEcoreTest.java
index 6164971..d06a7cb 100644
--- a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/ecore/XcoreEcoreTest.java
+++ b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/ecore/XcoreEcoreTest.java
@@ -1,7 +1,5 @@
package org.eclipse.emf.ecore.xcore.tests.ecore;
-import java.util.Map;
-
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xcore.XNamedElement;
@@ -9,7 +7,8 @@ import org.eclipse.emf.ecore.xcore.XcoreInjectorProvider;
import org.eclipse.emf.ecore.xcore.mappings.XcoreMapper;
import org.eclipse.emf.ecore.xcore.tests.GenModelFormatter;
import org.eclipse.xtext.junit4.InjectWith;
-import org.eclipse.xtext.junit4.parameterized.OffsetHelper;
+import org.eclipse.xtext.junit4.parameterized.InjectParameter;
+import org.eclipse.xtext.junit4.parameterized.Offset;
import org.eclipse.xtext.junit4.parameterized.ParameterizedXtextRunner;
import org.eclipse.xtext.junit4.parameterized.ResourceURIs;
import org.eclipse.xtext.junit4.parameterized.XpectString;
@@ -29,19 +28,16 @@ public class XcoreEcoreTest
@Inject
private XcoreMapper mapper;
- @Inject
- private OffsetHelper offsetHelper;
- private Map<String, String> params;
+
+ @InjectParameter
+ private Offset offset;
+
+ @InjectParameter
private XtextResource resource;
+
@Inject
private ValidationTestHelper validationHelper;
- public XcoreEcoreTest(XtextResource resource, Map<String, String> params)
- {
- this.resource = resource;
- this.params = params;
- }
-
@Test
public void noValidationIssues()
{
@@ -52,8 +48,7 @@ public class XcoreEcoreTest
public String eNamedElement()
{
EcoreUtil.resolveAll(resource);
- XNamedElement namedElement = (XNamedElement) offsetHelper.at(resource, params.get("offset")).getEObject();
- ENamedElement gen = mapper.getEcore(namedElement);
+ ENamedElement gen = mapper.getEcore((XNamedElement) offset.getEObject());
return new GenModelFormatter().resolveCrossReferences().format(gen);
}
diff --git a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/genmodel/XcoreGenModelTest.java b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/genmodel/XcoreGenModelTest.java
index 317f712..0cd7563 100644
--- a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/genmodel/XcoreGenModelTest.java
+++ b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/genmodel/XcoreGenModelTest.java
@@ -1,7 +1,5 @@
package org.eclipse.emf.ecore.xcore.tests.genmodel;
-import java.util.Map;
-
import org.eclipse.emf.codegen.ecore.genmodel.GenBase;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xcore.XNamedElement;
@@ -9,8 +7,9 @@ import org.eclipse.emf.ecore.xcore.XcoreInjectorProvider;
import org.eclipse.emf.ecore.xcore.mappings.XcoreMapper;
import org.eclipse.emf.ecore.xcore.tests.GenModelFormatter;
import org.eclipse.xtext.junit4.InjectWith;
-import org.eclipse.xtext.junit4.parameterized.OffsetHelper;
-import org.eclipse.xtext.junit4.parameterized.Parameter;
+import org.eclipse.xtext.junit4.parameterized.InjectParameter;
+import org.eclipse.xtext.junit4.parameterized.Offset;
+import org.eclipse.xtext.junit4.parameterized.ParameterSyntax;
import org.eclipse.xtext.junit4.parameterized.ParameterizedXtextRunner;
import org.eclipse.xtext.junit4.parameterized.ResourceURIs;
import org.eclipse.xtext.junit4.parameterized.XpectString;
@@ -30,19 +29,16 @@ public class XcoreGenModelTest
@Inject
private XcoreMapper mapper;
- @Inject
- private OffsetHelper offsetHelper;
- private Map<String, String> params;
+
+ @InjectParameter
+ private Offset offset;
+
+ @InjectParameter
private XtextResource resource;
+
@Inject
private ValidationTestHelper validationHelper;
- public XcoreGenModelTest(XtextResource resource, Map<String, String> params)
- {
- this.resource = resource;
- this.params = params;
- }
-
@Test
public void noValidationIssues()
{
@@ -50,12 +46,11 @@ public class XcoreGenModelTest
}
@XpectString
- @Parameter(syntax = "'at' offset=OFFSET")
+ @ParameterSyntax("'at' offset=OFFSET")
public String genBase()
{
EcoreUtil.resolveAll(resource);
- XNamedElement namedElement = (XNamedElement) offsetHelper.at(resource, params.get("offset")).getEObject();
- GenBase gen = mapper.getGen(namedElement);
+ GenBase gen = mapper.getGen((XNamedElement) offset.getEObject());
return new GenModelFormatter().resolveCrossReferences().format(gen);
}
diff --git a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/XcoreScopingTest.java b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/XcoreScopingTest.java
index be5be73..0eb16bd 100644
--- a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/XcoreScopingTest.java
+++ b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/XcoreScopingTest.java
@@ -1,15 +1,15 @@
package org.eclipse.emf.ecore.xcore.tests.scoping;
import java.util.List;
-import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.xcore.XcoreInjectorProvider;
import org.eclipse.xtext.junit4.InjectWith;
-import org.eclipse.xtext.junit4.parameterized.OffsetHelper;
-import org.eclipse.xtext.junit4.parameterized.Parameter;
+import org.eclipse.xtext.junit4.parameterized.InjectParameter;
+import org.eclipse.xtext.junit4.parameterized.Offset;
+import org.eclipse.xtext.junit4.parameterized.ParameterSyntax;
import org.eclipse.xtext.junit4.parameterized.ParameterizedXtextRunner;
import org.eclipse.xtext.junit4.parameterized.ResourceURIs;
import org.eclipse.xtext.junit4.parameterized.XpectCommaSeparatedValues;
@@ -33,22 +33,18 @@ import com.google.inject.Inject;
public class XcoreScopingTest
{
+ @InjectParameter
private XtextResource resource;
- private Map<String, String> params;
- @Inject
- private OffsetHelper offsetHelper;
+
+ @InjectParameter
+ private Offset offset;
+
@Inject
private ValidationTestHelper validationHelper;
+
@Inject
private IScopeProvider scopeProvider;
- public XcoreScopingTest(XtextResource resource, Map<String, String> params)
- {
- super();
- this.resource = resource;
- this.params = params;
- }
-
@Test
public void noValidationIssues()
{
@@ -56,11 +52,10 @@ public class XcoreScopingTest
}
@XpectCommaSeparatedValues()
- @Parameter(syntax = "'at' offset=OFFSET")
+ @ParameterSyntax("'at' offset=OFFSET")
public List<String> scopeAllElements()
{
- Pair<EObject, EStructuralFeature> objAndFeature = offsetHelper.at(resource, params.get("offset"))
- .getEStructuralFeatureByParent();
+ Pair<EObject, EStructuralFeature> objAndFeature = offset.getEStructuralFeatureByParent();
Assert.assertTrue(objAndFeature.getSecond() instanceof EReference);
Assert.assertFalse(((EReference) objAndFeature.getSecond()).isContainment());
IScope scope = scopeProvider.getScope(objAndFeature.getFirst(), (EReference) objAndFeature.getSecond());
diff --git a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/validation/XcoreValidationTest.java b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/validation/XcoreValidationTest.java
index 396d38d..d50c000 100644
--- a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/validation/XcoreValidationTest.java
+++ b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/validation/XcoreValidationTest.java
@@ -5,6 +5,7 @@ import java.util.List;
import org.eclipse.emf.ecore.util.EcoreValidator;
import org.eclipse.emf.ecore.xcore.XcoreInjectorProvider;
import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.parameterized.InjectParameter;
import org.eclipse.xtext.junit4.parameterized.ParameterizedXtextRunner;
import org.eclipse.xtext.junit4.parameterized.ResourceURIs;
import org.eclipse.xtext.junit4.parameterized.XpectLines;
@@ -51,17 +52,12 @@ import com.google.inject.Inject;
public class XcoreValidationTest
{
+ @InjectParameter
private XtextResource resource;
@Inject
private IResourceValidator validator;
- public XcoreValidationTest(XtextResource resource)
- {
- super();
- this.resource = resource;
- }
-
protected String formatIssue(Issue issue)
{
StringBuilder result = new StringBuilder();