void () { Disposer.register(myRoot, myFolder2); //noinspection SSBasedInspection Disposer.register(myRoot, () -> Disposer.dispose(myFolder2)); Disposer.dispose(myRoot); assertEquals(Arrays.asList(myFolder2, myRoot), myDisposedObjects); }