aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwannheden2009-07-08 13:33:42 (EDT)
committersefftinge2009-07-08 13:33:42 (EDT)
commit447d0a5bee2044e8333d20e357e12fa062f04b47 (patch)
treee501056d2552b0507c047f75bd9604bfecef3f44
parentfae3f12ac9dfe380ae9dc5e1bc15c8da204326cf (diff)
downloadorg.eclipse.xtext-447d0a5bee2044e8333d20e357e12fa062f04b47.zip
org.eclipse.xtext-447d0a5bee2044e8333d20e357e12fa062f04b47.tar.gz
org.eclipse.xtext-447d0a5bee2044e8333d20e357e12fa062f04b47.tar.bz2
Fix: Delegate handling of null tokens to value converter - https://bugs.eclipse.org/bugs/show_bug.cgi?id=280873
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java3
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/DefaultEcoreElementFactoryTest.java38
2 files changed, 40 insertions, 1 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java
index 11086a5..84d0941 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/generator/PluginTestSuite.java
@@ -42,7 +42,8 @@ public class PluginTestSuite {
suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.MetamodelRefTest.class);
suite.addTestSuite(org.eclipse.xtext.metamodelreferencing.tests.MultiGenMMTest.class);
suite.addTestSuite(org.eclipse.xtext.parseerrorhandling.ParseErrorHandlingTest.class);
- suite.addTestSuite(org.eclipse.xtext.parser.OffsetInformationTest.class);
+ suite.addTestSuite(org.eclipse.xtext.parser.DefaultEcoreElementFactoryTest.class);
+ suite.addTestSuite(org.eclipse.xtext.parser.OffsetInformationTest.class);
suite.addTestSuite(org.eclipse.xtext.parser.PartialParserReplaceTest.class);
suite.addTestSuite(org.eclipse.xtext.parser.PartialParserTest.class);
suite.addTestSuite(org.eclipse.xtext.parser.PartialParsingPerformanceTest.class);
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/DefaultEcoreElementFactoryTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/DefaultEcoreElementFactoryTest.java
new file mode 100644
index 0000000..d2daa6c
--- /dev/null
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/DefaultEcoreElementFactoryTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
+ * 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
+ *
+ *******************************************************************************/
+package org.eclipse.xtext.parser;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.xtext.conversion.IValueConverterService;
+
+/**
+ * @author Knut Wannheden - Initial contribution and API
+ */
+public class DefaultEcoreElementFactoryTest extends TestCase {
+
+ public void testConvertNullInput() throws Exception {
+ EClass eClass = EcoreFactory.eINSTANCE.createEClass();
+ IValueConverterService converter = EasyMock.createMock(IValueConverterService.class);
+
+ converter.toValue(null, "foo", null);
+ EasyMock.expectLastCall().andReturn("FOO");
+
+ EasyMock.replay(converter);
+ DefaultEcoreElementFactory factory = new DefaultEcoreElementFactory();
+ factory.setConverterService(converter);
+ factory.set(eClass, "name", null, "foo", null);
+
+ EasyMock.verify(converter);
+ assertEquals("FOO", eClass.getName());
+ }
+}