summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-04-23 16:55:39 (EDT)
committer sefftinge2009-04-23 16:55:39 (EDT)
commit671e55f338352e0b90d785d08a92131bb258767e (patch)
treedd32f0a7c03dd5d8ae4b1db61c503d4934d7df1d
parent97039567dac43645600237fcf71cb156c37d8005 (diff)
downloadorg.eclipse.xtext-671e55f338352e0b90d785d08a92131bb258767e.zip
org.eclipse.xtext-671e55f338352e0b90d785d08a92131bb258767e.tar.gz
org.eclipse.xtext-671e55f338352e0b90d785d08a92131bb258767e.tar.bz2
Fix: Concurrency issue in AbstractDeclarativeValidator
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ConcurrentValidationTest.java6
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ValidationTestHelper.java2
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ConcurrentValidationTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ConcurrentValidationTest.java
index 9beea42..b348aef 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ConcurrentValidationTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ConcurrentValidationTest.java
@@ -7,6 +7,8 @@
*******************************************************************************/
package org.eclipse.xtext.validator;
+import junit.framework.AssertionFailedError;
+
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.xtext.junit.AbstractXtextTests;
@@ -68,12 +70,14 @@ public class ConcurrentValidationTest extends AbstractXtextTests {
//
}
assertNull(runnable.lastEx);
+ assertNull(runnable.lastError);
}
private class PoorMansValidationJob implements Runnable {
private final AbstractDeclarativeValidator validator;
private IllegalStateException lastEx;
+ private AssertionFailedError lastError;
private PoorMansValidationJob(AbstractDeclarativeValidator validator) {
this.validator = validator;
@@ -86,6 +90,8 @@ public class ConcurrentValidationTest extends AbstractXtextTests {
helper.assertMatch(diagnostics, 1, 3);
} catch(IllegalStateException e) {
lastEx = e;
+ } catch(AssertionFailedError error) {
+ lastError = error;
}
}
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ValidationTestHelper.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ValidationTestHelper.java
index eb0f4e5..434c7a7 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ValidationTestHelper.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/ValidationTestHelper.java
@@ -24,8 +24,8 @@ import org.eclipse.emf.ecore.EStructuralFeature;
public class ValidationTestHelper {
public void assertMatch(TestChain chain, Integer... expectedFeatureIds) {
- Assert.assertEquals(expectedFeatureIds.length, chain.integers.size());
List<Integer> asList = Arrays.asList(expectedFeatureIds);
+ Assert.assertEquals("expected : " + asList + " , but was " + chain.integers, expectedFeatureIds.length, chain.integers.size());
Assert.assertTrue("expected : " + asList + " , but was " + chain.integers, asList.containsAll(chain.integers));
}