comparison 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
comparison
equal deleted inserted replaced
724:11fd16e1d8b3 725:7e1fa27b67ee
1 import junit.framework.*;
2 import java.io.File;
3 import org.omras2.*;
4
5 public class TestCreate extends TestCase
6 {
7 File testDBFile;
8
9 protected void setUp()
10 {
11 testDBFile = new File("testfiles/test.adb");
12 if(testDBFile.exists())
13 testDBFile.delete();
14 }
15
16 public void testCreateNew()
17 {
18 AudioDB testDB = new AudioDB(testDBFile);
19 assertTrue("DB created", testDB.create(5, 5, 12));
20 assertTrue("Test DB created on FS", testDBFile.exists());
21 assertTrue("Test DB has length > 0", testDBFile.length() > 0);
22 }
23
24 public void testReplaceExisting()
25 {
26 AudioDB testDB = new AudioDB(testDBFile);
27 assertTrue("DB created", testDB.create(5, 5, 12));
28
29 // Try to create again
30 testDB = new AudioDB(testDBFile);
31 assertFalse("DB not created", testDB.create(5, 5, 12));
32 assertTrue("Test DB still exists on FS", testDBFile.exists());
33 assertTrue("Test DB still has length > 0", testDBFile.length() > 0);
34 }
35 }