Updating tests with old images and made config more dynamic for #12.

This commit is contained in:
Rob Greene 2018-03-02 19:54:42 -06:00
parent ae72f3877e
commit afd8388848
18 changed files with 7 additions and 30 deletions

View File

@ -78,10 +78,6 @@ public class DiskHelperTest extends TestCase {
+ "/Marble Madness (1985)(Electronic Arts).2mg"); //$NON-NLS-1$
}
public void testLoadHd1() throws IOException, DiskException {
showDirectory("C:/My Apple2/ApplePC/hd1.hdv"); //$NON-NLS-1$
}
public void testRdosBoot() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/RDOSboot.dsk"); //$NON-NLS-1$
}
@ -119,12 +115,12 @@ public class DiskHelperTest extends TestCase {
public void testUniDosD3110() throws IOException, DiskException {
showDirectory(config.getDiskDir()
+ "/UniDOS/D3110.dsk"); //$NON-NLS-1$
+ "/D3110.dsk"); //$NON-NLS-1$
}
public void testUniDosD3151() throws IOException, DiskException {
showDirectory(config.getDiskDir()
+ "/UniDOS/D3151.dsk"); //$NON-NLS-1$
+ "/D3151.dsk"); //$NON-NLS-1$
}
protected FormattedDisk[] showDirectory(String imageName) throws IOException, DiskException {

View File

@ -19,21 +19,17 @@
*/
package com.webcodepro.applecommander.testconfig;
import java.io.InputStream;
import java.util.Properties;
/**
* A simple class to contains test configuration information.
* Update the file TestConfig.properties to match the system.
* <p>
* Note: Used to rely on a properties file; altered it to work
* more dynamically to allow tests to be run...
*
* @author Rob
*/
public class TestConfig {
private static final String FILENAME = "TestConfig.properties"; //$NON-NLS-1$
private static final String DISK_DIRECTORY = "DiskDir"; //$NON-NLS-1$
private static final String TEMP_DIRECTORY = "TempDir"; //$NON-NLS-1$
private static TestConfig instance;
private Properties properties = new Properties();
/**
* Hide constructor from other classes.
*/
@ -46,32 +42,19 @@ public class TestConfig {
public static TestConfig getInstance() {
if (instance == null) {
instance = new TestConfig();
instance.load();
}
return instance;
}
/**
* Initialize the test config from disk.
*/
private void load() {
try {
InputStream inputStream = getClass().getResourceAsStream(FILENAME);
properties.load(inputStream);
inputStream.close();
} catch (Exception ignored) {
// Ignored
}
}
/**
* Answer with the temp directory.
*/
public String getTempDir() {
return properties.getProperty(TEMP_DIRECTORY);
return System.getProperty("java.io.tmpdir");
}
/**
* Answer with the directory where disk images are stored.
*/
public String getDiskDir() {
return properties.getProperty(DISK_DIRECTORY);
return "./src/test/resources/disks";
}
}

View File

@ -1,2 +0,0 @@
DiskDir=C:/Documents and Settings/hp/My Documents/My Apple2/Disks
TempDir=C:/Temp

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.