### Question:
BottomUpTreeBuilderImpl implements BottomUpTreeBuilder<E, N> { @SuppressWarnings("unchecked") @Override public <T extends Tree<E, N>> T build(Class<T> klass) throws OperationNotSupportedForType { if (root == null) { final EmptyTreeConstructor<E, N, T> constructor = emptyTreeConstructorProvider.get(klass); return constructor.build(); } else { final T[] subtrees = (T[])Array.newInstance(keyMappingProvider.get(klass), children.length); for (int i = 0; i < children.length; i++) { subtrees[i] = children[i].build(klass); } final TreeConstructor<E, N, T> constructor = treeConstructorProvider.get(klass); return constructor.build(root, subtrees); } } @SuppressWarnings("unchecked")  BottomUpTreeBuilderImpl(TreeConstructorProvider treeConstructorProvider, EmptyTreeConstructorProvider emptyTreeConstructorProvider, KeyMappingProvider keyMappingProvider); @SuppressWarnings("unchecked") private  BottomUpTreeBuilderImpl(TreeConstructorProvider treeConstructorProvider, EmptyTreeConstructorProvider emptyTreeConstructorProvider, KeyMappingProvider keyMappingProvider, E e); private  BottomUpTreeBuilderImpl(TreeConstructorProvider treeConstructorProvider, EmptyTreeConstructorProvider emptyTreeConstructorProvider, KeyMappingProvider keyMappingProvider, E e, BottomUpTreeBuilder<E, N>[] builders); @Override BottomUpTreeBuilder<E, N> create(E e); @SuppressWarnings("unchecked") @Override BottomUpTreeBuilder<E, N> create(E e, BottomUpTreeBuilder<E, N> builder); @SuppressWarnings("unchecked") @Override BottomUpTreeBuilder<E, N> create(E e, BottomUpTreeBuilder<E, N> builder0, BottomUpTreeBuilder<E, N> builder1); @SuppressWarnings("unchecked") @Override BottomUpTreeBuilder<E, N> create(E e, BottomUpTreeBuilder<E, N> builder0, BottomUpTreeBuilder<E, N> builder1, BottomUpTreeBuilder<E, N> builder2); @SuppressWarnings("unchecked") @Override BottomUpTreeBuilder<E, N> create(E e, BottomUpTreeBuilder<E, N> builder0, BottomUpTreeBuilder<E, N> builder1, BottomUpTreeBuilder<E, N> builder2, BottomUpTreeBuilder<E, N> builder3); @SuppressWarnings("unchecked") @Override BottomUpTreeBuilder<E, N> create(E e, BottomUpTreeBuilder<E, N> builder0, BottomUpTreeBuilder<E, N> builder1, BottomUpTreeBuilder<E, N> builder2, BottomUpTreeBuilder<E, N> builder3, BottomUpTreeBuilder<E, N> builder4); @Override @SafeVarargs final BottomUpTreeBuilder<E, N> create(E e, BottomUpTreeBuilder<E, N>... builders); @SuppressWarnings("unchecked") @Override T build(Class<T> klass); @Override T build(TypeKey<T> type);  }### Answer:
@Test public void buildEmpty() { final BottomUpTreeBuilderImpl<String, MutableSettableStructuredNode<String>> builder = new BottomUpTreeBuilderImpl<>(treeConstructorProvider, emptyTreeConstructorProvider, KEY_MAPPING_PROVIDER); final LinkedTree<String> tree = builder.build(LinkedTree.<String>typeKey()); assertNull(tree.getRoot()); assertTrue(tree.isEmpty()); }