use of org.eclipse.xtext.xbase.ui.testing.FindReferencesTestUtil.MockAcceptor in project xtext-eclipse by eclipse.
the class FindReferencesTest method testFindReferencesTypeLiteralTwice.
@Test
public void testFindReferencesTypeLiteralTwice() throws Exception {
createFile("find.references.test/src/Test." + fileExtension, "com.acme.OtherwiseUnused != com.acme.OtherwiseUnused");
waitForBuild();
XtextResourceSet set = get(XtextResourceSet.class);
set.setClasspathURIContext(JavaCore.create(project));
Resource resource = set.getResource(URI.createPlatformResourceURI("find.references.test/src/Test." + fileExtension, true), true);
// obtain reference to type
XBinaryOperation expression = (XBinaryOperation) resource.getContents().get(0);
JvmType lookup = (JvmType) ((XAbstractFeatureCall) expression.getLeftOperand()).getFeature();
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(expression.getLeftOperand(), lookup, XABSTRACT_FEATURE_CALL__FEATURE);
mockAcceptor.expect(expression.getRightOperand(), lookup, XABSTRACT_FEATURE_CALL__FEATURE);
findReferencesTester.checkFindReferences(lookup, "Java References to com.acme.OtherwiseUnused", mockAcceptor);
}
use of org.eclipse.xtext.xbase.ui.testing.FindReferencesTestUtil.MockAcceptor in project xtext-eclipse by eclipse.
the class FindReferencesTest method testFindReferencesTypeLiteral.
@Test
public void testFindReferencesTypeLiteral() throws Exception {
createFile("find.references.test/src/Test." + fileExtension, "com.acme.OtherwiseUnused::m()");
waitForBuild();
XtextResourceSet set = get(XtextResourceSet.class);
set.setClasspathURIContext(JavaCore.create(project));
Resource resource = set.getResource(URI.createPlatformResourceURI("find.references.test/src/Test." + fileExtension, true), true);
// obtain reference to type
XMemberFeatureCall expression = (XMemberFeatureCall) resource.getContents().get(0);
JvmType lookup = (JvmType) ((XAbstractFeatureCall) expression.getMemberCallTarget()).getFeature();
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(expression.getMemberCallTarget(), lookup, XABSTRACT_FEATURE_CALL__FEATURE);
findReferencesTester.checkFindReferences(lookup, "Java References to com.acme.OtherwiseUnused", mockAcceptor);
}
Aggregations