### Question:
Sequence implements Procedure<A> { public Sequence<A> then(Procedure<? super A> p) { if (p != null) { list.add(p); } return this; } Sequence();  Sequence(Procedure<? super A>... procedures);  Sequence(Iterable<Procedure<? super A>> procedures); Sequence<A> then(Procedure<? super A> p); void run(A obj); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testThen() throws Exception { List<RunCounter> list = new ArrayList<RunCounter>(); Sequence<String> seq = new Sequence<String>(); seq.run(null); for (int i=0;i<10;i++) { RunCounter counter = new RunCounter(); seq.then(counter); list.add(counter); seq.run("xyzzy"); for (int j=0;j<list.size();j++) { assertEquals(list.size()-j,((list.get(j)).count)); } } }