use of org.eclipse.xtend.ide.tests.findrefs.FindReferencesTestUtil.MockAcceptor in project xtext-xtend by eclipse.
the class FindReferencesTest method testFindReferencesToConstructor.
@Test
public void testFindReferencesToConstructor() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo {}").getXtendTypes().get(0);
XtendClass classBar = (XtendClass) testHelper.xtendFile("Bar", "class Bar { def bar() {new Foo()} }").getXtendTypes().get(0);
waitForBuild();
JvmConstructor inferredConstructor = associations.getInferredConstructor(classFoo);
XtendFunction functionBar = (XtendFunction) classBar.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((XBlockExpression) functionBar.getExpression()).getExpressions().get(0), inferredConstructor, XCONSTRUCTOR_CALL__CONSTRUCTOR);
findReferencesTester.checkFindReferences(classFoo, "Java References to Foo (/test.project/src/Foo.xtend)", mockAcceptor);
}
use of org.eclipse.xtend.ide.tests.findrefs.FindReferencesTestUtil.MockAcceptor in project xtext-xtend by eclipse.
the class FindReferencesTest method testFindReferencesThis.
@Test
public void testFindReferencesThis() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo { def foo() {this} }").getXtendTypes().get(0);
waitForBuild();
JvmGenericType inferredType = associations.getInferredType(classFoo);
XtendFunction functionFoo = (XtendFunction) classFoo.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((XBlockExpression) functionFoo.getExpression()).getExpressions().get(0), inferredType, XABSTRACT_FEATURE_CALL__FEATURE);
findReferencesTester.checkFindReferences(inferredType, "Java References to Foo (/test.project/src/Foo.xtend)", mockAcceptor);
}
use of org.eclipse.xtend.ide.tests.findrefs.FindReferencesTestUtil.MockAcceptor in project xtext-xtend by eclipse.
the class FindReferencesTest method testFindReferencesToAnonymousSuperType.
@Test
public void testFindReferencesToAnonymousSuperType() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo {}").getXtendTypes().get(0);
XtendClass classBar = (XtendClass) testHelper.xtendFile("Bar", "class Bar { val foo = new Foo{} }").getXtendTypes().get(0);
waitForBuild();
XtendField fieldFoo = (XtendField) classBar.getMembers().get(0);
JvmGenericType inferredTypeFoo = associations.getInferredType(classFoo);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((AnonymousClass) fieldFoo.getInitialValue()).getConstructorCall(), inferredTypeFoo, XCONSTRUCTOR_CALL__CONSTRUCTOR);
findReferencesTester.checkFindReferences(inferredTypeFoo, "Java References to Foo (/test.project/src/Foo.xtend)", mockAcceptor);
}
use of org.eclipse.xtend.ide.tests.findrefs.FindReferencesTestUtil.MockAcceptor in project xtext-xtend by eclipse.
the class FindReferencesTest method testFindReferencesTypeLiteral.
@Test
public void testFindReferencesTypeLiteral() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo { def foo() { Foo } }").getXtendTypes().get(0);
waitForBuild();
JvmGenericType inferredType = associations.getInferredType(classFoo);
XtendFunction functionFoo = (XtendFunction) classFoo.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((XBlockExpression) functionFoo.getExpression()).getExpressions().get(0), inferredType, XABSTRACT_FEATURE_CALL__FEATURE);
findReferencesTester.checkFindReferences(inferredType, "Java References to Foo (/test.project/src/Foo.xtend)", mockAcceptor);
}
use of org.eclipse.xtend.ide.tests.findrefs.FindReferencesTestUtil.MockAcceptor in project xtext-xtend by eclipse.
the class FindReferencesTest method testFindReferencesTypeLiteralWithPackageFragment.
@Test
public void testFindReferencesTypeLiteralWithPackageFragment() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "package com.acme class Foo { def foo() { com.acme.Foo } }").getXtendTypes().get(0);
waitForBuild();
JvmGenericType inferredType = associations.getInferredType(classFoo);
XtendFunction functionFoo = (XtendFunction) classFoo.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((XBlockExpression) functionFoo.getExpression()).getExpressions().get(0), inferredType, XABSTRACT_FEATURE_CALL__FEATURE);
findReferencesTester.checkFindReferences(inferredType, "Java References to com.acme.Foo (/test.project/src/Foo.xtend)", mockAcceptor);
}
Aggregations