public void setDirectory(File directory) {
        this.directory = directory;
    }
@Test
    public void testKahaStartAndSizeCreatingStoreDirectoryConcurrently() throws Exception {
        // given mkdirs() will execute in parallel
        final CountDownLatch countDownLatch = new CountDownLatch(2);

        class ConcurrentMkdirsFile extends File {

            public ConcurrentMkdirsFile(File parent, String child) {
                super(parent, child);
            }

            @Override
            public boolean mkdirs() {
                countDownLatch.countDown();
                try {
                    countDownLatch.await(3, TimeUnit.SECONDS);
                    return super.mkdirs();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        // and KahaDBStore is configured
        KahaDBStore kaha = new KahaDBStore();
        kaha.setDirectory(new ConcurrentMkdirsFile(temporaryFolder.getRoot(), "kaha3"));

        // when both start() and size() are performed concurrently
        final Future<Long> size = Executors.newSingleThreadExecutor()
                .submit(kaha::size);
        kaha.start();

        // then KahaDB should successfully start
        assertTrue(kaha.isStarted());
        assertTrue(size.get() > 0);
    }