Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-10-23 14:52:14 +0000
committerCamille Letavernier2014-10-23 15:04:44 +0000
commitfb77eb1a047622852720c386c33400b27ad35aca (patch)
tree27a3d8f3c4fb7a9ea6892910edca9bf7529dae54 /tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests
parentf7c3d9f2a2ed45c584dee56e17ba0dd558fdeba9 (diff)
downloadorg.eclipse.papyrus-fb77eb1a047622852720c386c33400b27ad35aca.tar.gz
org.eclipse.papyrus-fb77eb1a047622852720c386c33400b27ad35aca.tar.xz
org.eclipse.papyrus-fb77eb1a047622852720c386c33400b27ad35aca.zip
448385: [XText Editors] Embedded editors must be tested
https://bugs.eclipse.org/bugs/show_bug.cgi?id=448385 - Add default value test for Ports and Properties
Diffstat (limited to 'tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests')
-rw-r--r--tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests/src/org/eclipse/papyrus/uml/textedit/property/tests/suites/PropertyGrammarTests.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests/src/org/eclipse/papyrus/uml/textedit/property/tests/suites/PropertyGrammarTests.java b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests/src/org/eclipse/papyrus/uml/textedit/property/tests/suites/PropertyGrammarTests.java
index ea72e9664d1..7d4138b980d 100644
--- a/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests/src/org/eclipse/papyrus/uml/textedit/property/tests/suites/PropertyGrammarTests.java
+++ b/tests/junit/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.property.tests/src/org/eclipse/papyrus/uml/textedit/property/tests/suites/PropertyGrammarTests.java
@@ -17,9 +17,11 @@ import org.eclipse.papyrus.uml.textedit.tests.AbstractGrammarTest;
import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.LiteralReal;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.VisibilityKind;
import org.junit.Assert;
@@ -72,6 +74,20 @@ public class PropertyGrammarTests extends AbstractGrammarTest<Property> {
Assert.assertEquals("# /p1 : model::type1", tester.getInitialText(testedProperty));
}
+ @Test
+ public void testDefaultValues() throws Exception {
+ testedProperty.setIsUnique(false);
+
+ LiteralReal defaultRealValue = UMLFactory.eINSTANCE.createLiteralReal();
+ defaultRealValue.setValue(123.54);
+ testedProperty.setDefaultValue(defaultRealValue);
+
+ Assert.assertEquals("+ p1 : <Undefined> = 123.54", tester.getInitialText(testedProperty));
+ tester.parseText(testedProperty, "p1 = .2");
+ Assert.assertEquals("The instance of ValueSpecification should not change when compatible types are used", defaultRealValue, testedProperty.getDefaultValue());
+ Assert.assertEquals(.2, defaultRealValue.getValue(), 0.001);
+ }
+
@Override
public DefaultXtextDirectEditorConfiguration getEditor() {
return new PropertyXtextDirectEditorConfiguration();

Back to the top