### Question:
NullarySequence implements NullaryProcedure { public final void run() { for (Iterator<NullaryProcedure> iter = list.iterator(); iter.hasNext();) { iter.next().run(); } } NullarySequence();  NullarySequence(NullaryProcedure... procedures);  NullarySequence(Iterable<NullaryProcedure> procedures); final NullarySequence then(NullaryProcedure p); final void run(); @Override final boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testRunZero() throws Exception { NullarySequence seq = new NullarySequence(); seq.run(); }
@Test public void testRunOne() throws Exception { RunCounter counter = new RunCounter(); NullarySequence seq = new NullarySequence(counter); assertEquals(0,counter.count); seq.run(); assertEquals(1,counter.count); }
@Test public void testRunTwo() throws Exception { RunCounter[] counter = { new RunCounter(), new RunCounter() }; NullarySequence seq = new NullarySequence(counter[0],counter[1]); assertEquals(0,counter[0].count); assertEquals(0,counter[1].count); seq.run(); assertEquals(1,counter[0].count); assertEquals(1,counter[1].count); }