aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwannheden2009-05-27 02:34:00 (EDT)
committersefftinge2009-05-27 02:34:00 (EDT)
commitc97ca4dd6c3c744c076f09a3c552b223e9c6f3af (patch)
tree830d704230812fabc08a8b08f2cbb2f8e3556c4c
parentde771e3b94c1678e441b64808a3aa8f73fd52798 (diff)
downloadorg.eclipse.xtext-c97ca4dd6c3c744c076f09a3c552b223e9c6f3af.zip
org.eclipse.xtext-c97ca4dd6c3c744c076f09a3c552b223e9c6f3af.tar.gz
org.eclipse.xtext-c97ca4dd6c3c744c076f09a3c552b223e9c6f3af.tar.bz2
DefaultIndexBasedScopeProvider lazily accesses index store
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/index/IndexBasedScopeProviderTest.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/index/IndexBasedScopeProviderTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/index/IndexBasedScopeProviderTest.java
index 35dce9b..f2b34f6 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/index/IndexBasedScopeProviderTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/index/IndexBasedScopeProviderTest.java
@@ -1,5 +1,3 @@
-package org.eclipse.xtext.index;
-
/*******************************************************************************
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
@@ -8,6 +6,7 @@ package org.eclipse.xtext.index;
* http://www.eclipse.org/legal/epl-v10.html
*
*******************************************************************************/
+package org.eclipse.xtext.index;
import static com.google.common.collect.Iterables.*;
@@ -18,6 +17,8 @@ import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.index.ecore.impl.EcoreIndexFeederImpl;
import org.eclipse.emf.index.impl.PersistableIndexStore;
import org.eclipse.emf.index.resource.impl.IndexFeederImpl;
@@ -207,6 +208,18 @@ public class IndexBasedScopeProviderTest extends AbstractGeneratorTest {
}
+ public void testLazyGlobalIndexAccess() throws Exception {
+ scopeProvider.setIndexStore(null);
+ IScope scope = scopeProvider.getScope(EcoreFactory.eINSTANCE.createEObject(), EcorePackage.Literals.EOBJECT);
+ assertNotNull(scope);
+ try {
+ scope.getContents();
+ fail("NullPointerException expected");
+ }
+ catch (NullPointerException e) {
+ }
+ }
+
private List<String> toListOfNames(Iterable<IScopedElement> elements) {
List<String> result = new ArrayList<String>();
for (IScopedElement e : elements) {