use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldFileDefaultTest method testReadWorldName.
/**
* Test of readWorldName method, of class WorldFileDefault.
*/
@Test
public void testReadWorldName() throws Exception {
System.out.println("readWorldName");
String worldName = "foobar";
World world = new World(worldName);
String wfjFile = folder.getRoot() + "/wfj";
String wfmm1File = folder.getRoot() + "/wfmm1";
try {
WorldFileJSON wfj = new WorldFileJSON(wfjFile);
wfj.writeFile(world);
WorldFileJSON wfmm1 = new WorldFileJSON(wfmm1File);
wfmm1.writeFile(world);
} catch (IOException ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail("Could not create files for test");
}
try {
WorldFileDefault instance1 = new WorldFileDefault(wfjFile);
String result1 = instance1.readWorldName();
assertEquals(worldName, result1);
WorldFileDefault instance2 = new WorldFileDefault(wfmm1File);
String result2 = instance2.readWorldName();
assertEquals(worldName, result2);
} catch (Exception ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail();
}
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldFileDefaultTest method testBackup.
/**
* Test of backup method, of class WorldFileDefault.
*/
@Test
public void testBackup() throws Exception {
System.out.println("backup");
try {
String wfFile = folder.getRoot() + "/wfj";
WorldFileDefault instance = new WorldFileDefault(wfFile);
// don't write world
// instance.writeFile(new World("Foo Bar"));
instance.backup();
File f1 = new File(wfFile);
File f2 = new File(wfFile + ".bak");
assertTrue(FileUtils.contentEquals(f1, f2));
} catch (FileNotFoundException ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail();
}
try {
String wfFile = folder.getRoot() + "/wfj";
WorldFileDefault instance = new WorldFileDefault(wfFile);
// write world
instance.writeFile(new World("Foo Bar"));
instance.backup();
File f1 = new File(wfFile);
File f2 = new File(wfFile + ".bak");
assertTrue(FileUtils.contentEquals(f1, f2));
} catch (FileNotFoundException ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail();
}
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldFileJSONTest method testCanRead.
/**
* Test of canRead method, of class WorldFileJSON.
*/
@Test
public void testCanRead() {
System.out.println("canRead");
World world = new World("foobar");
String wfjFile = folder.getRoot() + "/wfj";
try {
WorldFileJSON wfj = new WorldFileJSON(wfjFile);
wfj.writeFile(world);
} catch (IOException ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail("Could not create files for test");
}
WorldFileJSON instancewfj = new WorldFileJSON(wfjFile);
Boolean result = instancewfj.canRead();
assertTrue(result);
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldFileJSONTest method testBackup.
/**
* Test of backup method, of class WorldFileJSON.
* @throws java.io.IOException
*/
@Test
public void testBackup() throws IOException {
System.out.println("backup");
try {
String wfjFile = folder.getRoot() + "/wfj";
WorldFileJSON instance = new WorldFileJSON(wfjFile);
// don't write world
// instance.writeFile(new World("Foo Bar"));
instance.backup();
File f1 = new File(wfjFile);
File f2 = new File(wfjFile + ".bak");
assertTrue(FileUtils.contentEquals(f1, f2));
} catch (FileNotFoundException ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail();
}
try {
String wfjFile = folder.getRoot() + "/wfj";
WorldFileJSON instance = new WorldFileJSON(wfjFile);
// write world
instance.writeFile(new World("Foo Bar"));
instance.backup();
File f1 = new File(wfjFile);
File f2 = new File(wfjFile + ".bak");
assertTrue(FileUtils.contentEquals(f1, f2));
} catch (FileNotFoundException ex) {
Logger.getLogger(WorldFileJSONTest.class.getName()).log(Level.SEVERE, null, ex);
fail();
}
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldPanelTest method testGetWorld.
/**
* Test of getWorld method, of class WorldPanel.
*/
@Test
public void testGetWorld() {
System.out.println("getWorld");
World world = new World();
WorldPanel instance = new WorldPanel(null, world, false);
assertEquals(world, instance.getWorld());
}
Aggregations