Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java')
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java
new file mode 100644
index 000000000..a9c09963c
--- /dev/null
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.eef.tests.internal.controllers;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.eef.EEFSelectDescription;
+import org.eclipse.eef.core.api.controllers.IEEFSelectController;
+import org.eclipse.eef.core.internal.controllers.EEFSelectController;
+import org.eclipse.eef.tests.internal.EEFDataTests;
+import org.eclipse.emf.ecore.EClassifier;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit tests for {@link IEEFSelectController}.
+ *
+ * @author sbegaudeau
+ */
+@SuppressWarnings({ "checkstyle:javadocmethod" })
+public class EEFSelectControllerTests extends AbstractEEFControllerTests {
+ /**
+ * The name of the Project EClass.
+ */
+ private static final String PROJECT_ECLASS_NAME = "Project"; //$NON-NLS-1$
+
+ private IEEFSelectController selectController(String modelPath) {
+ EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
+ EEFSelectDescription description = widget(group(page(modelPath, 0), 0), EEFSelectDescription.class, 0);
+ return new EEFSelectController(description, newVariableManager(eClassifier), this.interpreter, this.editingDomain);
+ }
+
+ @Test
+ public void testLabel() {
+ testLabel(selectController(EEFDataTests.EEFSELECTCONTROLLERTESTS_LABEL), "Visibility:"); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testHelp() {
+ testHelp(selectController(EEFDataTests.EEFSELECTCONTROLLERTESTS_HELP), "Visibility Help"); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testValue() {
+ AtomicBoolean atomicBoolean = new AtomicBoolean(false);
+ IEEFSelectController controller = this.selectController(EEFDataTests.EEFSELECTCONTROLLERTESTS_VALUE);
+ controller.onNewValue(value -> {
+ assertThat(value, is("public")); //$NON-NLS-1$
+ atomicBoolean.set(true);
+ });
+ controller.refresh();
+ assertTrue(atomicBoolean.get());
+ }
+}

Back to the top