use of org.eclipse.xtend.ide.tests.findrefs.FindReferencesTestUtil.MockAcceptor in project xtext-xtend by eclipse.
the class FindReferencesTest method testFindReferencesFromReturnType.
@Test
public void testFindReferencesFromReturnType() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo {}").getXtendTypes().get(0);
XtendClass classBar = (XtendClass) testHelper.xtendFile("Bar", "class Bar { def Foo bar() {null} }").getXtendTypes().get(0);
waitForBuild();
JvmGenericType inferredTypeFoo = associations.getInferredType(classFoo);
XtendFunction functionBar = (XtendFunction) classBar.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(functionBar.getReturnType(), inferredTypeFoo, JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
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 testFindReferencesToAnonymousImplicitSuperConstructor.
@Test
public void testFindReferencesToAnonymousImplicitSuperConstructor() 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);
JvmConstructor inferredConstructor = associations.getInferredConstructor(classFoo);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((AnonymousClass) fieldFoo.getInitialValue()).getConstructorCall(), inferredConstructor, XCONSTRUCTOR_CALL__CONSTRUCTOR);
findReferencesTester.checkFindReferences(inferredConstructor, "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 testFindReferencesFromParameter.
@Test
public void testFindReferencesFromParameter() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo {}").getXtendTypes().get(0);
XtendClass classBar = (XtendClass) testHelper.xtendFile("Bar", "class Bar { def bar(Foo x) {null} }").getXtendTypes().get(0);
waitForBuild();
JvmGenericType inferredTypeFoo = associations.getInferredType(classFoo);
XtendFunction functionBar = (XtendFunction) classBar.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(functionBar.getParameters().get(0).getParameterType(), inferredTypeFoo, JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
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 testFindReferencesToFunction.
@Test
public void testFindReferencesToFunction() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo { def foo() {this} def bar() {foo()} }").getXtendTypes().get(0);
XtendClass classBar = (XtendClass) testHelper.xtendFile("Bar", "class Bar { def baz(Foo it) {foo()} }").getXtendTypes().get(0);
waitForBuild();
XtendFunction functionFoo = (XtendFunction) classFoo.getMembers().get(0);
XtendFunction functionBar = (XtendFunction) classFoo.getMembers().get(1);
JvmOperation inferredOperation = associations.getDirectlyInferredOperation(functionFoo);
XtendFunction functionBaz = (XtendFunction) classBar.getMembers().get(0);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(((XBlockExpression) functionBar.getExpression()).getExpressions().get(0), inferredOperation, XABSTRACT_FEATURE_CALL__FEATURE);
mockAcceptor.expect(((XBlockExpression) functionBaz.getExpression()).getExpressions().get(0), inferredOperation, XABSTRACT_FEATURE_CALL__FEATURE);
findReferencesTester.checkFindReferences(functionFoo, "Java References to Foo.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 testFindReferencesToClass.
@Test
public void testFindReferencesToClass() throws Exception {
XtendClass classFoo = (XtendClass) testHelper.xtendFile("Foo", "class Foo {}").getXtendTypes().get(0);
XtendClass classBar = (XtendClass) testHelper.xtendFile("Bar", "class Bar extends Foo {}").getXtendTypes().get(0);
waitForBuild();
JvmGenericType inferredTypeFoo = associations.getInferredType(classFoo);
final MockAcceptor mockAcceptor = new MockAcceptor();
mockAcceptor.expect(classBar.getExtends(), inferredTypeFoo, JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
findReferencesTester.checkFindReferences(classFoo, "Java References to Foo (/test.project/src/Foo.xtend)", mockAcceptor);
}
Aggregations