void () { DefaultLogger.disableStderrDumping(myRoot); Disposable parent = Disposer.newDisposable("parent"); Disposable last = Disposer.newDisposable("child"); Disposer.register(parent, () -> Disposer.register(parent, last)); UsefulTestCase.assertThrows(IncorrectOperationException.class, "Sorry but parent", () -> Disposer.dispose(parent)); assertTrue(Disposer.isDisposed(parent)); }