package jetbrains.mps.kernel.tests.iotests; /*Generated by MPS */ import jetbrains.mps.vfs.IFile; import jetbrains.mps.vfs.FileSystem; import org.jdom.JDOMException; import java.io.IOException; import org.jdom.output.XMLOutputter; import org.jdom.output.Format; import jetbrains.mps.util.JDOMUtil; import java.io.File; public abstract class TestUtils { public TestUtils() { } public static IFile dataFile(String name) { IFile data = FileSystem.getInstance().getFileByPath(TestUtils.class.getResource("data.zip").getFile() + "!/"); return data.getDescendant(name); } public static String readXml(IFile file) throws JDOMException, IOException { return new XMLOutputter(Format.getCompactFormat()).outputString(JDOMUtil.loadDocument(file).getRootElement()); } public static IFile tmpFile(String suffix) throws IOException { File tmpFile = File.createTempFile("mpstest", suffix); tmpFile.deleteOnExit(); return FileSystem.getInstance().getFileByPath(tmpFile.getPath()); } }