### Question:
SequenceItem extends Item { @Override LeafItem createLeaf (String[] names, int positionToCreate) { String nextName = ""; try { nextName = names[positionToCreate]; return getChild (nextName).createLeaf (names, positionToCreate + 1); } catch (IndexOutOfBoundsException ioobe) { throw new ExecutionException ("cannot assign to a structure, only to a structure field"); } catch (ExecutionException ee) { if (positionToCreate + 1 == names.length) { LeafItem leaf = new LeafItem (names[positionToCreate], this); add (nextName, leaf); return leaf; } else { SequenceItem child = new SequenceItem (names[positionToCreate], this); add (nextName, child); return child.createLeaf (names, positionToCreate + 1); } } } SequenceItem(String name, Item parent);   }### Answer:
@Test public void testCreateLeafAtSequence () { SequenceItem sequence = new SequenceItem (SEQUENCE_NAME, null); sequence.createLeaf (new String[] { SEQUENCE_NAME, LEAF_NAME }, 0); try { sequence.createLeaf (new String[] { SEQUENCE_NAME }, 0); fail ("no exception"); } catch (ExecutionException ee) { } }
@Test public void testCreateLeafWithNameBesideNumber () { SequenceItem sequence = new SequenceItem (SEQUENCE_NAME, null); sequence.createLeaf (new String[] { "0" }, 0); try { sequence.createLeaf (new String[] { LEAF_NAME }, 0); fail ("no exception"); } catch (ExecutionException ee) { } }