private File boxStoreDir;
public void setUp() throws IOException {
// store the database in the systems temporary files folder
File tempFile = File.createTempFile("object-store-test", "");
// ensure file does not exist so builder creates a directory instead
store = MyObjectBox.builder()
// add directory flag to change where ObjectBox puts its database files
// optional: add debug flags for more detailed ObjectBox log output
.debugFlags(DebugFlags.LOG_QUERIES | DebugFlags.LOG_QUERY_PARAMETERS)
public void tearDown() throws Exception {
public void testPutAndGet() {
Box<Note> box = store.boxFor(Note.class);