void () { Disposable parent = new MyLoggingDisposable("parent"); Disposable child = new MyLoggingDisposable("child"); UsefulTestCase.assertThrows(IllegalArgumentException.class, () -> Disposer.tryRegister(parent, parent)); assertTrue(Disposer.tryRegister(parent, child)); UsefulTestCase.assertThrows(IncorrectOperationException.class, () -> Disposer.tryRegister(child, parent)); Disposer.dispose(parent); assertFalse(Disposer.tryRegister(parent, child)); Disposer.dispose(child); }