package uk.gov.verifiablelog.merkletree;

import javax.xml.bind.DatatypeConverter;
import java.util.ArrayList;
import java.util.List;

import static java.util.stream.Collectors.toList;

class MerkleTreeTestUnit {
    public MerkleTree merkleTree;
    public List<byte[]> leaves;

    public MerkleTreeTestUnit(MerkleTree merkleTree, List<byte[]> leaves) {
        this.merkleTree = merkleTree;
        this.leaves = leaves;
    }
}

public class TestUtil {
    public static MerkleTree makeMerkleTree(List<byte[]> entries) {
        return new MerkleTree(Util.sha256Instance(), entries::get, entries::size);
    }

    public static MerkleTree makeMerkleTree(List<byte[]> entries, MemoizationStore memoizationStore) {
        return new MerkleTree(Util.sha256Instance(), entries::get, entries::size, memoizationStore);
    }

    public static MerkleTreeTestUnit makeMerkleTreeTestUnit(MemoizationStore memoizationStore) {
        List<byte[]> leafValues = new ArrayList<>();
        return new MerkleTreeTestUnit(makeMerkleTree(leafValues, memoizationStore), leafValues);
    }

    public static List<String> bytesToString(List<byte[]> listOfByteArrays) {
        return listOfByteArrays.stream().map(TestUtil::bytesToString).collect(toList());
    }

    public static String bytesToString(byte[] bytes) {
        return DatatypeConverter.printHexBinary(bytes).toLowerCase();
    }

    public static byte[] stringToBytes(String input) {
        return DatatypeConverter.parseHexBinary(input);
    }
}

@@ -80,36 +80,8 @@
 er;%0A
-import java.util.ArrayList;%0A
 impo
@@ -99,16 +99,16 @@
 l.List;%0A
+
 %0Aimport 
@@ -155,255 +155,8 @@
 t;%0A%0A
-class MerkleTreeTestUnit %7B%0A    public MerkleTree merkleTree;%0A    public List%3Cbyte%5B%5D%3E leaves;%0A%0A    public MerkleTreeTestUnit(MerkleTree merkleTree, List%3Cbyte%5B%5D%3E leaves) %7B%0A        this.merkleTree = merkleTree;%0A        this.leaves = leaves;%0A    %7D%0A%7D%0A%0A
 publ
@@ -428,32 +428,32 @@
 izationStore) %7B%0A
+
         return n
@@ -548,262 +548,8 @@
  %7D%0A%0A
-    public static MerkleTreeTestUnit makeMerkleTreeTestUnit(MemoizationStore memoizationStore) %7B%0A        List%3Cbyte%5B%5D%3E leafValues = new ArrayList%3C%3E();%0A        return new MerkleTreeTestUnit(makeMerkleTree(leafValues, memoizationStore), leafValues);%0A    %7D%0A%0A
     

Remove unused utils and legacy dto test item class