HashTreeBuilder implements TreeBuilder<ImprintNode> { public ImprintNode build() throws HashException { if (heads.isEmpty()) { throw new IllegalStateException("Add leaf nodes before building a tree"); } return getRootNode(heads); } HashTreeBuilder(HashAlgorithm algorithm);  HashTreeBuilder(); void add(ImprintNode node); void add(ImprintNode node, IdentityMetadata metadata); long calculateHeight(ImprintNode node); long calculateHeight(ImprintNode node, IdentityMetadata metadata); void add(ImprintNode... nodes); ImprintNode build();  }
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Add leaf nodes before building a tree") public void testBuildTreeWithoutLeafs() { builder.build(); }