fixed UriBasedReaderTest (#32)

Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
Christian Dietrich 2016-07-12 19:38:36 +02:00
parent 88894d23b8
commit fa84a99b56

View file

@ -8,6 +8,8 @@
package org.eclipse.xtext.mwe;
import java.io.File;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.List;
import org.eclipse.emf.ecore.EPackage;
@ -72,7 +74,7 @@ public class UriBasedReaderTest extends AbstractXtextTests {
@Test public void testTransitiveReferences() throws Exception {
UriBasedReader reader = new UriBasedReader();
reader.addRegister(new ImportUriTestLanguageStandaloneSetup());
reader.addUri("file:/" + pathTo("importUriSubfolder/Start.importuritestlanguage"));
reader.addUri(pathTo2("importUriSubfolder/Start.importuritestlanguage"));
SlotEntry slotEntry = new SlotEntry();
slotEntry.setType("Type");
@ -195,8 +197,11 @@ public class UriBasedReaderTest extends AbstractXtextTests {
assertTrue(errorString, errorString.contains(errorURI));
}
public String pathTo(String string) throws Exception {
return new ReaderTest().pathTo(string).replace(File.separator, "/");
public String pathTo2(String string) throws Exception {
Path path = FileSystems.getDefault().getPath("").toAbsolutePath().resolve("src/"+getClass().getName().replace('.', '/') + ".java").getParent();
Path resolved = path.resolve(string);
String result = resolved.toUri().toString();
return result;
}
}