@Test
public void testTransactionTree() {

  
  TransactionTree tree = new TransactionTree();
  int nodes = 0;
  int total = 0;
  for (int i = 0; i < MAX_TRANSACTIONS; i++) {
    IntArrayList array = generateRandomArray();
    total += array.size();
    nodes += tree.addPattern(array, 1 + gen.nextInt(MAX_DUPLICATION));
  }
  log.info("Input integers: {}", total);
  log.info("Input data Size: {}", total * SIZE_INT / (double) MEGABYTE);
  log.info("Nodes in Tree: {}", nodes);
  log.info("Size of Tree: {}", (nodes * SIZE_INT * NUM_OF_FPTREE_FIELDS + tree.childCount() * SIZE_INT)
      / (double) MEGABYTE);
  TransactionTree vtree = new TransactionTree();
  StringBuilder sb = new StringBuilder();
  int count = 0;
  int items = 0;
  Iterator<Pair<IntArrayList,Long>> it = tree.iterator();
  while (it.hasNext()) {
    Pair<IntArrayList,Long> p = it.next();
    vtree.addPattern(p.getFirst(), p.getSecond());
    items += p.getFirst().size();
    count++;
    sb.append(p);
  }
  log.info("Number of transaction integers: {}", items);
  log.info("Size of Transactions: {}", (items * SIZE_INT + count * SIZE_LONG) / (double) MEGABYTE);
  log.info("Number of Transactions: {}", count);
  tree.getCompressedTree();
  it = vtree.iterator();
  StringBuilder sb1 = new StringBuilder();
  while (it.hasNext()) {
    sb1.append(it.next());
  }
  assertEquals(sb.toString(), sb1.toString());
  TransactionTree mtree = new TransactionTree();
  MultiTransactionTreeIterator mt = new MultiTransactionTreeIterator(vtree.iterator());
  while (mt.hasNext()) {
    mtree.addPattern(mt.next(), 1);
  }
  it = mtree.iterator();
  StringBuilder sb2 = new StringBuilder();
  while (it.hasNext()) {
    sb2.append(it.next());
  }
  assertEquals(sb.toString(), sb2.toString());
}