Eliminate use of TestUtil.

This commit is contained in:
Michael Bayne
2015-03-14 09:54:42 -07:00
parent 95294dd6fe
commit 2199bfd21a
3 changed files with 16 additions and 11 deletions
@@ -23,6 +23,7 @@ package com.threerings.whirled.tools.xml;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.xml.sax.SAXException;
@@ -90,15 +91,23 @@ public class SceneParser
}
/**
* Parses the XML file at the specified path into a scene model
* instance.
* Parses the XML file at the specified path into a scene model instance.
*/
public SceneModel parseScene (String path)
throws IOException, SAXException
{
return parseScene(new FileInputStream(path));
}
/**
* Parses the XML file provided by {@code scene} into a scene model instance.
*/
public SceneModel parseScene (InputStream scene)
throws IOException, SAXException
{
_model = null;
_digester.push(this);
_digester.parse(new FileInputStream(path));
_digester.parse(scene);
return _model;
}
@@ -24,8 +24,6 @@ package com.threerings.whirled.spot.tools.xml;
import junit.framework.Test;
import junit.framework.TestCase;
import com.samskivert.test.TestUtil;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.spot.data.Location;
import com.threerings.whirled.tools.xml.SceneParser;
@@ -50,8 +48,8 @@ public class SpotSceneParserTest extends TestCase
return new StageLocation(); // breaks package, but ok
}
});
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
SceneModel scene = parser.parseScene(tspath);
SceneModel scene = parser.parseScene(
getClass().getClassLoader().getResourceAsStream(TEST_SCENE_PATH));
System.out.println("Parsed " + scene + ".");
} catch (Exception e) {
@@ -24,8 +24,6 @@ package com.threerings.whirled.tools.xml;
import junit.framework.Test;
import junit.framework.TestCase;
import com.samskivert.test.TestUtil;
import com.threerings.whirled.data.SceneModel;
public class SceneParserTest extends TestCase
@@ -40,8 +38,8 @@ public class SceneParserTest extends TestCase
{
try {
SceneParser parser = new SceneParser("scene");
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
SceneModel scene = parser.parseScene(tspath);
SceneModel scene = parser.parseScene(
getClass().getClassLoader().getResourceAsStream(TEST_SCENE_PATH));
System.out.println("Parsed " + scene + ".");
} catch (Exception e) {