BlindingMaskLinkingHashTreeBuilder implements TreeBuilder<ImprintNode> { @Override public long calculateHeight(ImprintNode node) throws KSIException { Util.notNull(node, "Node"); return treeBuilder.calculateHeight(calculateNewNode(node)); } BlindingMaskLinkingHashTreeBuilder(byte[] initializationVector);  BlindingMaskLinkingHashTreeBuilder(byte[] initializationVector, DataHash previousBlockHash);  BlindingMaskLinkingHashTreeBuilder(HashAlgorithm algorithm, byte[] initializationVector, DataHash previousBlockHash);  BlindingMaskLinkingHashTreeBuilder(HashAlgorithm algorithm,
                                              byte[] initializationVector,
                                              DataHash previousBlockHash,
                                              TreeBuilder<ImprintNode> treeBuilder); @Override void add(ImprintNode node); @Override void add(ImprintNode node, IdentityMetadata metadata); @Override long calculateHeight(ImprintNode node); @Override long calculateHeight(ImprintNode node, IdentityMetadata metadata); @Override void add(ImprintNode... nodes); @Override ImprintNode build(); DataHash getLastNodeHash();  }
@Test public void testCalculateHeight() throws KSIException { BlindingMaskLinkingHashTreeBuilder builder = createTreeBuilder(); builder.add(new ImprintNode(DATA_HASH_2)); Assert.assertEquals(builder.calculateHeight(new ImprintNode(DATA_HASH_3)), 2); }
@Test(expectedExceptions = UnsupportedOperationException.class, expectedExceptionsMessageRegExp = "Identity metadata is not supported by BlindingMaskLinkingHashTreeBuilder") public void testCalculateHeightThrowsExceptionWhenIdentityMetadataIsPresent() { BlindingMaskLinkingHashTreeBuilder builder = createTreeBuilder(); builder.calculateHeight(new ImprintNode(DATA_HASH_2), new IdentityMetadata("1")); }