    @Test
    public void recoverTest() throws IOException {

        JournalPersistence store =
                new PositioningStore();
        store.recover(path, new Properties());
        int size = 10;
        int maxLength = 999;
        long start = store.max();
        List<byte[]> journals = ByteUtils.createRandomSizeByteList(maxLength, size);
        int length = journals.stream().mapToInt(journal -> journal.length).sum();

        long writePosition = 0L;
        for (byte[] journal : journals) {
            writePosition = store.append(journal);
        }

        Assert.assertEquals(length + start, writePosition);
        Assert.assertEquals(writePosition, store.max());

        while (store.flushed() < store.max()) {
            store.flush();
        }

        store.close();
        store =
                new PositioningStore();
        store.recover(path, new Properties());

        byte[] readBytes = store.read(start, length);
        byte[] writeBytes = ByteUtils.concatBytes(journals);
        Assert.assertArrayEquals(writeBytes, readBytes);
        store.close();

    }