### Question:
TransactionRunnable { public <U extends T> TransactionRunnable<U> runIn(final TransactionRunnable<U> parentRunnable) { if (this.parent != null) { throw new IllegalStateException("This TransactionRunnable is already scheduled to run inside " + this.parent.toString() + " and cannot be run in " + parentRunnable.toString() + " too."); } if (parentRunnable.hasPreRun) { throw new IllegalStateException("This TransactionRunnable cannot be runIn() " + parentRunnable + " because it has already started 'the ship has set sail'"); } parentRunnable.assertNoLoop(this); this.parent = (TransactionRunnable<T>) parentRunnable; parentRunnable.allRunnables.add(this); return (TransactionRunnable<U>) this; }  TransactionRunnable<U> runIn(final TransactionRunnable<U> parentRunnable);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void infiniloopTest() { testCase.runIn(new TransactionRunnable().runIn(testCase)); }
@Test(expected = IllegalStateException.class) public void runInMultiTest() { testCase.runIn(new TransactionRunnable()); testCase.runIn(new TransactionRunnable()); }