### Question:
NullarySequence implements NullaryProcedure { @Override public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof NullarySequence)) { return false; } NullarySequence that = (NullarySequence) obj; return this.list.equals(that.list); } 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 testEquals() throws Exception { NullarySequence p = new NullarySequence(); assertEquals(p,p); NullarySequence q = new NullarySequence(); assertObjectsAreEqual(p,q); for (int i=0;i<3;i++) { p.then(new NoOp()); assertObjectsAreNotEqual(p,q); q.then(new NoOp()); assertObjectsAreEqual(p,q); p.then(new NullarySequence(new NoOp(),new NoOp())); assertObjectsAreNotEqual(p,q); q.then(new NullarySequence(new NoOp(),new NoOp())); assertObjectsAreEqual(p,q); } assertObjectsAreNotEqual(p,new NoOp()); assertTrue(!p.equals(null)); }