@Test
public void buildMerkleTree() throws IOException {

    java.io.File dataFile1 = getFilePathByPartition(configuration, 0, 0);
    Files.touch(dataFile1);
    partitionService.setActive(new Partition(0, 0));
    File file = fileListService.getFile(0, 0);
    byte[] data = new byte[128];
    for (int i = 0; i < 128; i++) {
        data[i] = 0x1;
    }
    file.getFileChannel().write(ByteBuffer.wrap(data), 0);
    IndexElt expected = new IndexElt.IndexEltBuilder()
            .id(214803434770010112L)
            .type(1)
            .partition(new Partition(0, 0))
            .offset(0L)
            .length(128L)
            .metadata(ImmutableMap.of("key", "value"))
            .crc(FileUtils.getCrc(data))
            .build();
    indexService.add(expected);
    MerkleTree tree = FileUtils.buildMerkleTree(indexService, file, new Partition(0, 0));
    assertEquals(tree.getLeafNodes().get(0).getRange(), Range.openClosed(214803434770010111L, 214803434770010112L));
    assertEquals(tree.getLeafNodes().get(0).getHash(), new byte[]{2, -5, 34, -107, -6, 0, 16, 0, 0, 0, 0, 1});
    file.close();
}