Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.mapdb;
 
 import org.junit.After;
 import org.junit.Test;
 
 import java.io.File;
 
public class Issue89Test {
        private static final String MY_TEST_DATA_FILE = UtilsTest.tempDbFile().getAbsolutePath();
        private static final String MAP_DB_DATA_FILE_TO_REMOVE =  + ".0";
        private static final String TEST_TREE_SET = "TestTreeSet";
        private static final String DUMMY_CONTENT = "DummyContent";
        @Before
        public void setUp() throws Exception {
            deleteFile();
        }
        @After
        public void tearDown() throws Exception {
            deleteFile();
        }
        @Test
        public void testAppend() throws Exception {
            appendToDataFile();
            appendToDataFile();
            appendToDataFile();
            appendToDataFile();
        }
        private void appendToDataFile() {
            final DB myTestDataFile = createMapDB();
            addData(myTestDataFile);
            myTestDataFile.close();
        }
        private void addData(DB myTestDataFile) {
            final NavigableSet<ObjecttestTreeSet = myTestDataFile.getTreeSet();
            testTreeSet.add();
            myTestDataFile.commit();
        }
        private DB createMapDB(String fileName) {
            final File file = new File(fileName);
            return createMapDB(file);
        }
        private DB createMapDB(File file) {
            return DBMaker.newAppendFileDB(file)
                    .closeOnJvmShutdown()
                    .cacheDisable()
                    .make();
        }
        private void deleteFile() {
            final File file = new File();
            if (file.exists()) {
                file.delete();
            }
        }
    }
New to GrepCode? Check out our FAQ X