Add ability to test welcome info retrieval from IDE
This commit is contained in:
parent
90fb0f0470
commit
8171492a8a
@ -6,6 +6,7 @@ import net.sf.openrocket.util.BuildProperties;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -22,7 +23,12 @@ public abstract class WelcomeInfoRetriever {
|
||||
ClassLoader cl = WelcomeInfoRetriever.class.getClassLoader();
|
||||
InputStream in = cl.getResourceAsStream("ReleaseNotes.md");
|
||||
if (in == null) {
|
||||
throw new FileNotFoundException("ReleaseNotes.md not found");
|
||||
// Try to load the file from the file system (only really useful when running the unit tests directly from your IDE)
|
||||
File f = new File("../ReleaseNotes.md");
|
||||
in = f.toURI().toURL().openStream();
|
||||
if (in == null) {
|
||||
throw new FileNotFoundException("ReleaseNotes.md not found");
|
||||
}
|
||||
}
|
||||
InputSource source = new InputSource(new InputStreamReader(in));
|
||||
ReleaseNotesHandler handler = new ReleaseNotesHandler(version);
|
||||
|
@ -9,10 +9,6 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class WelcomeInfoTest extends BaseTestCase {
|
||||
|
||||
/**
|
||||
* Note: this unit test will fail if you don't run it using 'ant unittest', because otherwise
|
||||
* it can't load the ReleaseNotes.md file.
|
||||
*/
|
||||
@Test
|
||||
public void testWelcomeInfo() throws Exception {
|
||||
// Test the welcome info for the current build version
|
||||
|
Loading…
x
Reference in New Issue
Block a user