testClearUndisposedObjects() {
    /** Use computed properties to avoid compiler checks of defines. */
    Disposable['MONITORING_MODE'] = Disposable.MonitoringMode.PERMANENT;

    const d1 = new DisposableTest();
    const d2 = new DisposableTest();
    d2.dispose();
    Disposable.clearUndisposedObjects();
    assertSameElements(
        'no undisposed object in the registry', [],
        Disposable.getUndisposedObjects());

    assertThrows('disposal after clearUndisposedObjects()', () => {
      d1.dispose();
    });

    // d2 is already disposed of, the redisposal shouldn't throw error.
    d2.dispose();
  }
Use computed properties to avoid compiler checks of defines.