Search in sources :

Example 1 with ResourceLoadHelper

use of org.eclipse.xtext.ui.testing.util.ResourceLoadHelper in project n4js by eclipse.

the class N4ContentAssistProcessorTestBuilderHelper method createTestBuilderForResource.

/**
 * @param resource
 *            the resource under test
 * @return the configured content assist test builder (resource set and resource content appended).
 * @throws Exception
 *             some exception
 */
public N4ContentAssistProcessorTestBuilder createTestBuilderForResource(XtextResource resource) throws Exception {
    N4ContentAssistProcessorTestBuilder fixture = testBuilder.create(new ResourceLoadHelper() {

        @Override
        public XtextResource getResourceFor(InputStream stream) {
            return XtextResourceCleanUtil.cleanXtextResource(resource);
        }
    });
    fixture = fixture.append(resource.getParseResult().getRootNode().getText());
    return fixture;
}
Also used : ResourceLoadHelper(org.eclipse.xtext.ui.testing.util.ResourceLoadHelper) InputStream(java.io.InputStream) XtextResource(org.eclipse.xtext.resource.XtextResource)

Aggregations

InputStream (java.io.InputStream)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 ResourceLoadHelper (org.eclipse.xtext.ui.testing.util.ResourceLoadHelper)1