// Path: src/main/java/be/bagofwords/db/impl/BaseDataInterface.java
// public abstract class BaseDataInterface<T extends Object> implements DataInterface<T> {
// 
//     protected final Combinator<T> combinator;
//     protected final Class<T> objectClass;
//     protected final String name;
//     protected final boolean isTemporaryDataInterface;
//     protected final ObjectSerializer<T> objectSerializer;
//     private final Object closeLock = new Object();
//     private boolean wasClosed;
// 
//     public BaseDataInterface(String name, Class<T> objectClass, Combinator<T> combinator, ObjectSerializer<T> objectSerializer, boolean isTemporaryDataInterface) {
//         if (StringUtils.isEmpty(name)) {
//             throw new IllegalArgumentException("Name can not be null or empty");
//         }
//         this.objectClass = objectClass;
//         this.name = name;
//         this.isTemporaryDataInterface = isTemporaryDataInterface;
//         this.combinator = combinator;
//         this.objectSerializer = objectSerializer;
//     }
// 
//     public abstract DataInterface<T> getCoreDataInterface();
// 
//     protected abstract void doClose();
// 
//     public Combinator<T> getCombinator() {
//         return combinator;
//     }
// 
//     @Override
//     public ObjectSerializer<T> getObjectSerializer() {
//         return objectSerializer;
//     }
// 
// 
//     public Class<T> getObjectClass() {
//         return objectClass;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public final void close() {
//         ifNotClosed(() -> {
//                     if (isTemporaryDataInterface) {
//                         dropAllData();
//                     }
//                     flush();
//                     doClose();
//                     wasClosed = true;
//                 }
//         );
//     }
// 
//     public final boolean wasClosed() {
//         return wasClosed;
//     }
// 
//     @Override
//     protected void finalize() throws Throwable {
//         ifNotClosed(() -> {
//             if (!isTemporaryDataInterface()) {
//                 //the user did not close the data interface himself?
//                 Log.i("Closing data interface " + getName() + " because it is about to be garbage collected.");
//             }
//             close();
//         });
//         super.finalize();
//     }
// 
//     public void ifNotClosed(Runnable action) {
//         synchronized (closeLock) {
//             if (!wasClosed()) {
//                 action.run();
//             }
//         }
//     }
// 
//     public boolean isTemporaryDataInterface() {
//         return isTemporaryDataInterface;
//     }
// 
//     @Override
//     public long apprDataChecksum() {
//         CloseableIterator<KeyValue<T>> valueIterator = iterator();
//         final int numToSample = 10000;
//         long checksum = 0;
//         int numDone = 0;
//         while (valueIterator.hasNext() && numDone < numToSample) {
//             KeyValue<T> next = valueIterator.next();
//             if (next.getValue() == null) {
//                 throw new RuntimeException("Iterating over values returned null for key " + next.getKey());
//             }
//             T value = next.getValue();
//             checksum += checksum * 31 + value.hashCode();
//             numDone++;
//         }
//         valueIterator.close();
//         return checksum;
//     }
// 
//     /**
//      * You don't want to use this if you could use apprSize()
//      */
// 
//     @Override
//     public long exactSize() {
//         long result = 0;
//         CloseableIterator<Long> keyIt = keyIterator();
//         while (keyIt.hasNext()) {
//             keyIt.next();
//             result++;
//         }
//         keyIt.close();
//         return result;
//     }
// 
// }


import be.bagofwords.db.helper.EvenKeysFilter;
import be.bagofwords.db.helper.EvenNumbersValueFilter;
import be.bagofwords.db.helper.TestObject;
import be.bagofwords.db.impl.BaseDataInterface;
import be.bagofwords.db.methods.RangeKeyFilter;
import be.bagofwords.iterator.CloseableIterator;
import be.bagofwords.iterator.IterableUtils;
import be.bagofwords.util.HashUtils;
import be.bagofwords.util.KeyValue;
import be.bagofwords.util.Utils;
import org.apache.commons.lang3.mutable.MutableInt;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
    }

    @Test
    public void testNullString() {
        BaseDataInterface<String> db = createDataInterface("testNullString", String.class).caching(type).create();
        db.dropAllData();
        db.write("test", "null");
        db.flush();
        Assert.assertEquals("null", db.read("test"));
        db.write("test", null);
        db.flush();
        Assert.assertEquals(null, db.read("test"));
        db.write("test", "null");
        db.flush();
        Assert.assertEquals("null", db.read("test"));
    }

    @Test
    public void testMightContain() {
        BaseDataInterface<String> db = createDataInterface("testMightContain", String.class).caching(type).create();
        db.write("doescontain", "hoi");
        db.write("someothervalue1", "daag");
        db.flush();
        Assert.assertTrue(db.mightContain("doescontain"));
        Assert.assertTrue(db.mightContain("someothervalue1"));
        Assert.assertFalse(db.mightContain("someothervalue2"));
    }

    @Test
    public void testAccents() {
// Path: src/main/java/be/bagofwords/db/impl/BaseDataInterface.java
// public abstract class BaseDataInterface<T extends Object> implements DataInterface<T> {
// 
//     protected final Combinator<T> combinator;
//     protected final Class<T> objectClass;
//     protected final String name;
//     protected final boolean isTemporaryDataInterface;
//     protected final ObjectSerializer<T> objectSerializer;
//     private final Object closeLock = new Object();
//     private boolean wasClosed;
// 
//     public BaseDataInterface(String name, Class<T> objectClass, Combinator<T> combinator, ObjectSerializer<T> objectSerializer, boolean isTemporaryDataInterface) {
//         if (StringUtils.isEmpty(name)) {
//             throw new IllegalArgumentException("Name can not be null or empty");
//         }
//         this.objectClass = objectClass;
//         this.name = name;
//         this.isTemporaryDataInterface = isTemporaryDataInterface;
//         this.combinator = combinator;
//         this.objectSerializer = objectSerializer;
//     }
// 
//     public abstract DataInterface<T> getCoreDataInterface();
// 
//     protected abstract void doClose();
// 
//     public Combinator<T> getCombinator() {
//         return combinator;
//     }
// 
//     @Override
//     public ObjectSerializer<T> getObjectSerializer() {
//         return objectSerializer;
//     }
// 
// 
//     public Class<T> getObjectClass() {
//         return objectClass;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public final void close() {
//         ifNotClosed(() -> {
//                     if (isTemporaryDataInterface) {
//                         dropAllData();
//                     }
//                     flush();
//                     doClose();
//                     wasClosed = true;
//                 }
//         );
//     }
// 
//     public final boolean wasClosed() {
//         return wasClosed;
//     }
// 
//     @Override
//     protected void finalize() throws Throwable {
//         ifNotClosed(() -> {
//             if (!isTemporaryDataInterface()) {
//                 //the user did not close the data interface himself?
//                 Log.i("Closing data interface " + getName() + " because it is about to be garbage collected.");
//             }
//             close();
//         });
//         super.finalize();
//     }
// 
//     public void ifNotClosed(Runnable action) {
//         synchronized (closeLock) {
//             if (!wasClosed()) {
//                 action.run();
//             }
//         }
//     }
// 
//     public boolean isTemporaryDataInterface() {
//         return isTemporaryDataInterface;
//     }
// 
//     @Override
//     public long apprDataChecksum() {
//         CloseableIterator<KeyValue<T>> valueIterator = iterator();
//         final int numToSample = 10000;
//         long checksum = 0;
//         int numDone = 0;
//         while (valueIterator.hasNext() && numDone < numToSample) {
//             KeyValue<T> next = valueIterator.next();
//             if (next.getValue() == null) {
//                 throw new RuntimeException("Iterating over values returned null for key " + next.getKey());
//             }
//             T value = next.getValue();
//             checksum += checksum * 31 + value.hashCode();
//             numDone++;
//         }
//         valueIterator.close();
//         return checksum;
//     }
// 
//     /**
//      * You don't want to use this if you could use apprSize()
//      */
// 
//     @Override
//     public long exactSize() {
//         long result = 0;
//         CloseableIterator<Long> keyIt = keyIterator();
//         while (keyIt.hasNext()) {
//             keyIt.next();
//             result++;
//         }
//         keyIt.close();
//         return result;
//     }
// 
// }


// Path: src/test/java/be/bagofwords/db/TestDataInterface.java
import be.bagofwords.db.helper.EvenKeysFilter;
import be.bagofwords.db.helper.EvenNumbersValueFilter;
import be.bagofwords.db.helper.TestObject;
import be.bagofwords.db.impl.BaseDataInterface;
import be.bagofwords.db.methods.RangeKeyFilter;
import be.bagofwords.iterator.CloseableIterator;
import be.bagofwords.iterator.IterableUtils;
import be.bagofwords.util.HashUtils;
import be.bagofwords.util.KeyValue;
import be.bagofwords.util.Utils;
import org.apache.commons.lang3.mutable.MutableInt;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

    }

    @Test
    public void testNullString() {
        BaseDataInterface<String> db = createDataInterface("testNullString", String.class).caching(type).create();
        db.dropAllData();
        db.write("test", "null");
        db.flush();
        Assert.assertEquals("null", db.read("test"));
        db.write("test", null);
        db.flush();
        Assert.assertEquals(null, db.read("test"));
        db.write("test", "null");
        db.flush();
        Assert.assertEquals("null", db.read("test"));
    }

    @Test
    public void testMightContain() {
        BaseDataInterface<String> db = createDataInterface("testMightContain", String.class).caching(type).create();
        db.write("doescontain", "hoi");
        db.write("someothervalue1", "daag");
        db.flush();
        Assert.assertTrue(db.mightContain("doescontain"));
        Assert.assertTrue(db.mightContain("someothervalue1"));
        Assert.assertFalse(db.mightContain("someothervalue2"));
    }

    @Test
    public void testAccents() {
        BaseDataInterface<String> dataInterface = createDataInterface("testAccents", String.class).caching(type).create();