Search in sources :

Example 6 with URIBasedTestResourceDescription

use of org.eclipse.xtext.junit4.util.URIBasedTestResourceDescription in project xtext-eclipse by eclipse.

the class StateBasedContainerManagerTest method testGetVisibleContainers_02.

@Test
public void testGetVisibleContainers_02() {
    IFile file = getFile(project1, "doesNotExist");
    URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
    IResourceDescription description = new URIBasedTestResourceDescription(uri);
    List<IContainer> visibleContainers = containerManager.getVisibleContainers(description, this);
    assertEquals(2, visibleContainers.size());
    assertEquals(3, Iterables.size(visibleContainers.get(0).getResourceDescriptions()));
    assertEquals(1, Iterables.size(visibleContainers.get(1).getResourceDescriptions()));
    assertNotNull(visibleContainers.get(0).getResourceDescription(uri));
    assertNotNull(visibleContainers.get(0).getResourceDescription(uri1));
    assertNotNull(visibleContainers.get(0).getResourceDescription(uri2));
    assertNotNull(visibleContainers.get(1).getResourceDescription(uri3));
}
Also used : URIBasedTestResourceDescription(org.eclipse.xtext.junit4.util.URIBasedTestResourceDescription) IFile(org.eclipse.core.resources.IFile) IResourceDescription(org.eclipse.xtext.resource.IResourceDescription) IContainer(org.eclipse.xtext.resource.IContainer) URI(org.eclipse.emf.common.util.URI) Test(org.junit.Test)

Aggregations

URIBasedTestResourceDescription (org.eclipse.xtext.junit4.util.URIBasedTestResourceDescription)6 URI (org.eclipse.emf.common.util.URI)4 IContainer (org.eclipse.xtext.resource.IContainer)4 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)4 Test (org.junit.Test)4 IFile (org.eclipse.core.resources.IFile)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 IDirtyResource (org.eclipse.xtext.ui.editor.IDirtyResource)1