aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-07-19 04:21:45 -0400
committerAlexander Kurtakov2018-07-19 04:21:45 -0400
commit877b838e1db19298f37c6c2ee4ee8c5f8e1c1f8a (patch)
tree2aa5e0ac34df667a0d69fe84ab2f8dbbbedf1e41
parentac19df769f2fefd3997ba07c44eea6ff8b63a61e (diff)
downloadeclipse.platform.runtime-877b838e1db19298f37c6c2ee4ee8c5f8e1c1f8a.tar.gz
eclipse.platform.runtime-877b838e1db19298f37c6c2ee4ee8c5f8e1c1f8a.tar.xz
eclipse.platform.runtime-877b838e1db19298f37c6c2ee4ee8c5f8e1c1f8a.zip
Convert ExpressionTests to JUnit 4.
Change-Id: I157e1a10ba6e5f75c4506ce437cef53af18868e1 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java5
-rw-r--r--tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java127
2 files changed, 96 insertions, 36 deletions
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
index dcb7915b9..32357200d 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
+import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -18,7 +19,7 @@ public class AllTests {
public static Test suite() {
TestSuite suite= new TestSuite("All Expression Language Tests"); //$NON-NLS-1$
suite.addTest(PropertyTesterTests.suite());
- suite.addTest(ExpressionTests.suite());
+ suite.addTest(new JUnit4TestAdapter(ExpressionTests.class));
suite.addTest(ExpressionInfoTests.suite());
suite.addTest(CountExpressionTest.suite());
return suite;
diff --git a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
index 921a9be3e..4ee48c712 100644
--- a/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
+++ b/tests/org.eclipse.core.expressions.tests/src/org/eclipse/core/internal/expressions/tests/ExpressionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -10,6 +10,13 @@
*******************************************************************************/
package org.eclipse.core.internal.expressions.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.net.URL;
import java.util.AbstractCollection;
import java.util.ArrayList;
@@ -23,6 +30,7 @@ import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import org.junit.Test;
import org.osgi.framework.FrameworkUtil;
import org.w3c.dom.Document;
@@ -56,12 +64,8 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class ExpressionTests extends TestCase {
+public class ExpressionTests {
private static final int TYPE_ITERATIONS = 100000;
@@ -69,22 +73,14 @@ public class ExpressionTests extends TestCase {
public Collection<String> collection;
}
- public static Test suite() {
- return new TestSuite(ExpressionTests.class);
- }
-
+ @Test(expected = CoreException.class)
public void testEscape() throws Exception {
assertEquals("Str'ing", Expressions.unEscapeString("Str''ing")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("'", Expressions.unEscapeString("''")); //$NON-NLS-1$ //$NON-NLS-2$
- boolean caught= false;
- try {
- Expressions.unEscapeString("'"); //$NON-NLS-1$
- } catch (CoreException e) {
- caught= true;
- }
- assertTrue(caught);
+ Expressions.unEscapeString("'"); //$NON-NLS-1$
}
+ @Test
public void testArgumentConversion() throws Exception {
assertNull(Expressions.convertArgument(null));
assertEquals("", Expressions.convertArgument("")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -102,6 +98,7 @@ public class ExpressionTests extends TestCase {
assertEquals(Float.valueOf(1.7f), Expressions.convertArgument("1.7")); //$NON-NLS-1$
}
+ @Test
public void testArgumentParsing() throws Exception {
Object[] result= null;
@@ -161,12 +158,14 @@ public class ExpressionTests extends TestCase {
assertTrue(caught);
}
+ @Test
public void testSystemProperty() throws Exception {
SystemTestExpression expression= new SystemTestExpression("os.name", System.getProperty("os.name")); //$NON-NLS-1$ //$NON-NLS-2$
EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Object()));
assertTrue(result == EvaluationResult.TRUE);
}
+ @Test
public void testAdaptExpression() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
@@ -174,6 +173,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result == EvaluationResult.TRUE);
}
+ @Test
public void testAdaptExpressionAdaptable() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.Adapter")); //$NON-NLS-1$
@@ -181,7 +181,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result == EvaluationResult.TRUE);
}
-
+ @Test
public void testAdaptExpressionNotEqual() throws Exception {
AdaptExpression expression1 = new AdaptExpression(
"org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
@@ -195,6 +195,7 @@ public class ExpressionTests extends TestCase {
.equals(expression2));
}
+ @Test
public void testAdaptExpressionHashCode() throws Exception {
AdaptExpression expression1 = new AdaptExpression(
"org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
@@ -208,12 +209,14 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testAdaptExpressionFail() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.NotExisting"); //$NON-NLS-1$
EvaluationResult result= expression.evaluate(new EvaluationContext(null, new Adaptee()));
assertTrue(result == EvaluationResult.FALSE);
}
+ @Test
public void testAdaptExpressionFail2() throws Exception {
AdaptExpression expression= new AdaptExpression("org.eclipse.core.internal.expressions.tests.Adapter"); //$NON-NLS-1$
expression.add(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.NotExisting")); //$NON-NLS-1$
@@ -221,7 +224,8 @@ public class ExpressionTests extends TestCase {
assertTrue(result == EvaluationResult.FALSE);
}
- /** Bug 484325 */
+ /* Bug 484325 */
+ @Test
public void testAdaptExpressionWithNull() throws Exception {
// it's surprisingly difficult to craft an EvaluationContext that
// provides
@@ -237,6 +241,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result == EvaluationResult.FALSE);
}
+ @Test
public void testAndExpressionNotEqual() throws Exception {
AndExpression expression1 = new AndExpression();
expression1.add(new InstanceofExpression(
@@ -248,6 +253,7 @@ public class ExpressionTests extends TestCase {
.equals(expression2));
}
+ @Test
public void testAndExpressionHashCode() throws Exception {
AndExpression expression1 = new AndExpression();
expression1.add(new InstanceofExpression(
@@ -259,6 +265,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testCountExpressionNotEqual() throws Exception {
CountExpression expression1 = new CountExpression("+");
CountExpression expression2 = new CountExpression("!");
@@ -266,6 +273,7 @@ public class ExpressionTests extends TestCase {
.equals(expression2));
}
+ @Test
public void testCountExpressionHashCode() throws Exception {
CountExpression expression1 = new CountExpression("*");
CountExpression expression2 = new CountExpression("*");
@@ -273,6 +281,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testEnablementExpressionNotEqual() throws Exception {
EnablementExpression expression1 = new EnablementExpression((IConfigurationElement)null);
expression1.add(new InstanceofExpression(
@@ -284,6 +293,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testEnablementExpressionHashCode() throws Exception {
EnablementExpression expression1 = new EnablementExpression((IConfigurationElement)null);
expression1.add(new InstanceofExpression(
@@ -295,6 +305,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testEqualsExpressionNotEqual() throws Exception {
EqualsExpression expression1 = new EqualsExpression("+");
EqualsExpression expression2 = new EqualsExpression("!");
@@ -302,6 +313,7 @@ public class ExpressionTests extends TestCase {
.equals(expression2));
}
+ @Test
public void testEqualsExpressionHashCode() throws Exception {
EqualsExpression expression1 = new EqualsExpression("*");
EqualsExpression expression2 = new EqualsExpression("*");
@@ -309,6 +321,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testInstanceOfExpressionNotEqual() throws Exception {
InstanceofExpression expression1 = new InstanceofExpression("+");
InstanceofExpression expression2 = new InstanceofExpression("!");
@@ -316,6 +329,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testInstanceOfExpressionHashCode() throws Exception {
InstanceofExpression expression1 = new InstanceofExpression("*");
InstanceofExpression expression2 = new InstanceofExpression("*");
@@ -323,6 +337,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testIterateExpressionNotEqual() throws Exception {
IterateExpression expression1 = new IterateExpression("or");
expression1.add(new InstanceofExpression(
@@ -334,6 +349,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testIterateExpressionHashCode() throws Exception {
IterateExpression expression1 = new IterateExpression("and");
expression1.add(new InstanceofExpression(
@@ -345,6 +361,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testNotExpressionNotEqual() throws Exception {
NotExpression expression1 = new NotExpression(new InstanceofExpression(
"org.eclipse.core.internal.expressions.tests.Adapter1"));
@@ -354,6 +371,7 @@ public class ExpressionTests extends TestCase {
.equals(expression2));
}
+ @Test
public void testNotExpressionHashCode() throws Exception {
NotExpression expression1 = new NotExpression(new InstanceofExpression(
"org.eclipse.core.internal.expressions.tests.Adapter"));
@@ -363,6 +381,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testOrExpressionNotEqual() throws Exception {
OrExpression expression1 = new OrExpression();
expression1.add(new InstanceofExpression(
@@ -374,6 +393,7 @@ public class ExpressionTests extends TestCase {
.equals(expression2));
}
+ @Test
public void testOrExpressionHashCode() throws Exception {
OrExpression expression1 = new OrExpression();
expression1.add(new InstanceofExpression(
@@ -385,6 +405,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testResolveExpressionNotEqual() throws Exception {
ResolveExpression expression1 = new ResolveExpression("variable1",
new Object[0]);
@@ -398,6 +419,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testResolveExpressionHashCode() throws Exception {
ResolveExpression expression1 = new ResolveExpression("variable",
new Object[0]);
@@ -411,6 +433,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testSystemTestExpressionNotEqual() throws Exception {
SystemTestExpression expression1 = new SystemTestExpression("prop",
"value1");
@@ -420,6 +443,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testSystemTestExpressionHashCode() throws Exception {
SystemTestExpression expression1 = new SystemTestExpression("prop",
"value");
@@ -429,6 +453,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testTestExpressionNotEqual() throws Exception {
TestExpression expression1 = new TestExpression("namespace", "prop",
new Object[0], "value1");
@@ -438,6 +463,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testTestExpressionHashCode() throws Exception {
TestExpression expression1 = new TestExpression("namespace", "prop",
new Object[0], "value");
@@ -447,6 +473,7 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test
public void testWithExpressionNotEqual() throws Exception {
WithExpression expression1 = new WithExpression("variable1");
expression1.add(new InstanceofExpression(
@@ -458,6 +485,7 @@ public class ExpressionTests extends TestCase {
!expression1.equals(expression2));
}
+ @Test
public void testWithExpressionHashCode() throws Exception {
WithExpression expression1 = new WithExpression("variable");
expression1.add(new InstanceofExpression(
@@ -469,18 +497,15 @@ public class ExpressionTests extends TestCase {
expression1.hashCode(), expression2.hashCode());
}
+ @Test(expected = CoreException.class)
public void testWithExpressionNoVariable() throws Exception {
WithExpression expr = new WithExpression("variable");
expr.add(new EqualsExpression(new Object()));
EvaluationContext context = new EvaluationContext(null, new Object());
- try {
- expr.evaluate(context);
- fail("Should throw exceptoin");
- } catch (CoreException e) {
- // this is success
- }
+ expr.evaluate(context);
}
+ @Test
public void testWithExpressionUndefinedVariable() throws Exception {
WithExpression expr = new WithExpression("variable");
expr.add(new EqualsExpression(new Object()));
@@ -489,21 +514,20 @@ public class ExpressionTests extends TestCase {
assertEquals(EvaluationResult.FALSE, expr.evaluate(context));
}
+ @Test
public void testVariableResolver() throws Exception {
final Object result= new Object();
- IVariableResolver resolver= new IVariableResolver() {
- @Override
- public Object resolve(String name, Object[] args) throws CoreException {
- assertEquals("variable", name); //$NON-NLS-1$
- assertEquals("arg1", args[0]); //$NON-NLS-1$
- assertEquals(Boolean.TRUE, args[1]);
- return result;
- }
+ IVariableResolver resolver = (name, args) -> {
+ assertEquals("variable", name); //$NON-NLS-1$
+ assertEquals("arg1", args[0]); //$NON-NLS-1$
+ assertEquals(Boolean.TRUE, args[1]);
+ return result;
};
EvaluationContext context= new EvaluationContext(null, new Object(), new IVariableResolver[] { resolver });
assertTrue(result == context.resolveVariable("variable", new Object[] {"arg1", Boolean.TRUE})); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testEqualsExpression() throws Exception {
EqualsExpression exp= new EqualsExpression("name"); //$NON-NLS-1$
EvaluationContext context= new EvaluationContext(null, "name"); //$NON-NLS-1$
@@ -518,6 +542,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionAnyNumber() throws Exception {
CountExpression exp= new CountExpression("*"); //$NON-NLS-1$
@@ -538,6 +563,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionExact() throws Exception {
CountExpression exp= new CountExpression("2"); //$NON-NLS-1$
@@ -560,6 +586,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionNoneOrOne() throws Exception {
CountExpression exp= new CountExpression("?"); //$NON-NLS-1$
@@ -579,6 +606,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionOneOrMore() throws Exception {
CountExpression exp= new CountExpression("+"); //$NON-NLS-1$
@@ -598,6 +626,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionNone() throws Exception {
CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
@@ -617,6 +646,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionNoneWithAdapterManager() throws Exception {
CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
@@ -639,6 +669,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testCountExpressionFailure() throws Exception {
CountExpression exp= new CountExpression("!"); //$NON-NLS-1$
@@ -653,6 +684,7 @@ public class ExpressionTests extends TestCase {
}
}
+ @Test
public void testInstanceofTrue() throws Exception {
B b= new B();
EvaluationContext context= new EvaluationContext(null, b);
@@ -667,6 +699,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testInstanceofFalse() throws Exception {
A a= new A();
EvaluationContext context= new EvaluationContext(null, a);
@@ -675,6 +708,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionAndTrue() throws Exception {
final List<Object> result= new ArrayList<>();
Expression myExpression= new Expression() {
@@ -694,6 +728,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result.equals(input));
}
+ @Test
public void testIterateExpressionAndFalse() throws Exception {
final List<Object> result= new ArrayList<>();
Expression myExpression= new Expression() {
@@ -713,6 +748,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result.size() == 1 && result.get(0).equals("one")); //$NON-NLS-1$
}
+ @Test
public void testIterateExpressionOrTrue() throws Exception {
final List<Object> result= new ArrayList<>();
Expression myExpression= new Expression() {
@@ -732,6 +768,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result.size() == 1 && result.get(0).equals("one")); //$NON-NLS-1$
}
+ @Test
public void testIterateExpressionOrFalse() throws Exception {
final List<Object> result= new ArrayList<>();
Expression myExpression= new Expression() {
@@ -751,6 +788,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result.equals(input));
}
+ @Test
public void testIterateExpressionOrMultiChildren() throws Exception {
//Test for Bug 260522: <iterate> iterates over collection elements,
//thereby *and*-ing all evaluated child expressions
@@ -763,6 +801,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionAndMultiChildren() throws Exception {
//Test for Bug 260522: <iterate> iterates over collection elements,
//thereby *and*-ing all evaluated child expressions
@@ -776,6 +815,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionEmptyOr() throws Exception {
IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
List<?> input = new ArrayList<>();
@@ -783,6 +823,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionEmptyAnd() throws Exception {
IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
List<?> input = new ArrayList<>();
@@ -790,6 +831,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionAnd_IfEmptyTrue() throws Exception {
IterateExpression exp= new IterateExpression("and", "true"); //$NON-NLS-1$
List<?> input = new ArrayList<>();
@@ -797,6 +839,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionAnd_IfEmptyFalse() throws Exception {
IterateExpression exp= new IterateExpression("and", "false"); //$NON-NLS-1$
List<?> input = new ArrayList<>();
@@ -804,6 +847,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionOr_IfEmptyTrue() throws Exception {
IterateExpression exp= new IterateExpression("or", "true"); //$NON-NLS-1$
List<?> input = new ArrayList<>();
@@ -811,6 +855,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionOr_IfEmptyFalse() throws Exception {
IterateExpression exp= new IterateExpression("or", "false"); //$NON-NLS-1$
List<?> input = new ArrayList<>();
@@ -818,6 +863,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionWithAdapterManager() throws Exception {
final List<Object> result= new ArrayList<>();
Expression myExpression= new Expression() {
@@ -839,6 +885,7 @@ public class ExpressionTests extends TestCase {
assertTrue(result.equals(input));
}
+ @Test
public void testIterateExpressionWithAdapterManagerEmptyAnd() throws Exception {
IterateExpression exp= new IterateExpression("and"); //$NON-NLS-1$
final List<String> input= new ArrayList<>();
@@ -848,6 +895,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionWithAdapterManagerEmptyOr() throws Exception {
IterateExpression exp= new IterateExpression("or"); //$NON-NLS-1$
final List<String> input= new ArrayList<>();
@@ -857,6 +905,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionWithAdapterManagerIfEmptyFalse() throws Exception {
IterateExpression exp= new IterateExpression("or", "false"); //$NON-NLS-1$
final List<String> input= new ArrayList<>();
@@ -866,6 +915,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionWithAdapterManagerIfEmptyTrue() throws Exception {
IterateExpression exp= new IterateExpression("or", "true"); //$NON-NLS-1$
final List<String> input= new ArrayList<>();
@@ -875,6 +925,7 @@ public class ExpressionTests extends TestCase {
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
+ @Test
public void testIterateExpressionFailure() throws Exception {
IterateExpression exp= new IterateExpression((String)null);
@@ -889,6 +940,7 @@ public class ExpressionTests extends TestCase {
}
}
+ @Test
public void testReadXMLExpression() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -897,6 +949,7 @@ public class ExpressionTests extends TestCase {
ExpressionConverter.getDefault().perform(enable);
}
+ @Test
public void testReadDOMExpression() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -917,6 +970,7 @@ public class ExpressionTests extends TestCase {
}
}
+ @Test
public void testForcePluginActivation() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -933,6 +987,7 @@ public class ExpressionTests extends TestCase {
assertTrue(!test.testGetForcePluginActivation());
}
+ @Test
public void testPlatformPropertyTester() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -951,7 +1006,7 @@ public class ExpressionTests extends TestCase {
return null;
}
-
+ @Test
public void testDefinitionExpression() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions", "definitions");
@@ -972,6 +1027,7 @@ public class ExpressionTests extends TestCase {
assertEquals(EvaluationResult.TRUE, probExpr.evaluate(context));
}
+ @Test
public void testReferenceExpression() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -993,6 +1049,7 @@ public class ExpressionTests extends TestCase {
assertEquals(EvaluationResult.TRUE, probExpr.evaluate(context));
}
+ @Test
public void testTwoReferences() throws Exception {
IExtensionRegistry registry= Platform.getExtensionRegistry();
IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions.tests", "testParticipants"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1018,6 +1075,7 @@ public class ExpressionTests extends TestCase {
assertEquals(EvaluationResult.TRUE, probExpr.evaluate(context));
}
+ @Test
public void testSubType() throws Exception {
EvaluationContext context= new EvaluationContext(null, IEvaluationContext.UNDEFINED_VARIABLE);
ArrayList<AbstractCollection<?>> list = new ArrayList<>();
@@ -1051,6 +1109,7 @@ public class ExpressionTests extends TestCase {
assertEquals(EvaluationResult.TRUE, with.evaluate(context));
}
+ @Test
public void testSubTypeTiming() throws Exception {
HashSet<?> o1 = new HashSet<>();