use of org.eclipse.xtext.resource.XtextResource in project xtext-xtend by eclipse.
the class EObjectLocationTests method testResolveAnonymousClassConstructorCall_2.
@Test
public void testResolveAnonymousClassConstructorCall_2() throws Exception {
String model = "class Foo { val bar = new Bar() {} } class Bar { new(String x) {} new() {} }";
XtendFile file = file(model);
XtextResource resource = (XtextResource) file.eResource();
EObject constructor = eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, model.indexOf("Bar"));
assertTrue(constructor instanceof JvmConstructor);
assertEquals("Bar", ((JvmConstructor) constructor).getDeclaringType().getSimpleName());
assertEquals(0, ((JvmConstructor) constructor).getParameters().size());
}
use of org.eclipse.xtext.resource.XtextResource in project xtext-xtend by eclipse.
the class EObjectLocationTests method testResolveAnonymousClassConstructorCall_1.
@Test
public void testResolveAnonymousClassConstructorCall_1() throws Exception {
String model = "class Foo { val bar = new Bar() {} } class Bar {}";
XtendFile file = file(model);
XtextResource resource = (XtextResource) file.eResource();
EObject constructor = eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, model.indexOf("Bar"));
assertTrue(constructor instanceof JvmConstructor);
assertEquals("Bar", ((JvmConstructor) constructor).getDeclaringType().getSimpleName());
}
use of org.eclipse.xtext.resource.XtextResource in project xtext-xtend by eclipse.
the class EObjectLocationTests method testResolveAnonymousClassConstructorCall_5.
@Test
public void testResolveAnonymousClassConstructorCall_5() throws Exception {
String model = "class Foo { val bar = new Bar() {} } class Bar { new(String x) {} }";
XtendFile file = file(model);
XtextResource resource = (XtextResource) file.eResource();
EObject constructor = eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, model.indexOf("Bar"));
assertTrue(constructor instanceof JvmConstructor);
assertEquals("Bar", ((JvmConstructor) constructor).getDeclaringType().getSimpleName());
assertEquals(1, ((JvmConstructor) constructor).getParameters().size());
}
use of org.eclipse.xtext.resource.XtextResource in project xtext-xtend by eclipse.
the class EObjectLocationTests method testResolveAnonymousClassConstructorCall_3.
@Test
public void testResolveAnonymousClassConstructorCall_3() throws Exception {
String model = "class Foo { val bar = new Bar('') {} } class Bar { new(String x) {} new() {} }";
XtendFile file = file(model);
XtextResource resource = (XtextResource) file.eResource();
EObject constructor = eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, model.indexOf("Bar"));
assertTrue(constructor instanceof JvmConstructor);
assertEquals("Bar", ((JvmConstructor) constructor).getDeclaringType().getSimpleName());
assertEquals(1, ((JvmConstructor) constructor).getParameters().size());
}
use of org.eclipse.xtext.resource.XtextResource in project xtext-xtend by eclipse.
the class LinkingErrorTest method testNoExceptionInValidator_03.
@Test
public void testNoExceptionInValidator_03() throws Exception {
XtendClass clazz = clazz("package pack class Case_4 {\n" + " richStrings_01() {\n" + " '''foobar'''\n" + " }\n" + " richStrings_02() {\n" + " '''�'start'�\n" + " first line\n'''" + "");
assertNoExceptions(clazz);
XtextResource resource = (XtextResource) clazz.eResource();
validateWithoutException(resource);
}
Aggregations