diff bindings/java/test/TestCreate.java @ 725:7e1fa27b67ee

* Full status support * Insert support (not fully tested) * Unit tests for create + initial insert
author mas01mj
date Wed, 21 Jul 2010 14:27:07 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/java/test/TestCreate.java	Wed Jul 21 14:27:07 2010 +0000
@@ -0,0 +1,35 @@
+import junit.framework.*;
+import java.io.File;
+import org.omras2.*;
+
+public class TestCreate extends TestCase
+{
+	File testDBFile;
+
+	protected void setUp()
+	{
+		testDBFile = new File("testfiles/test.adb");
+		if(testDBFile.exists())
+			testDBFile.delete();
+	}
+
+	public void testCreateNew()
+	{
+		AudioDB testDB = new AudioDB(testDBFile);
+		assertTrue("DB created", testDB.create(5, 5, 12));
+		assertTrue("Test DB created on FS", testDBFile.exists());
+		assertTrue("Test DB has length > 0", testDBFile.length() > 0);
+	}
+
+	public void testReplaceExisting()
+	{
+		AudioDB testDB = new AudioDB(testDBFile);
+		assertTrue("DB created", testDB.create(5, 5, 12));
+
+		// Try to create again
+		testDB = new AudioDB(testDBFile);
+		assertFalse("DB not created", testDB.create(5, 5, 12));
+		assertTrue("Test DB still exists on FS", testDBFile.exists());
+		assertTrue("Test DB still has length > 0", testDBFile.length() > 0);
+	}
+}