private synchronized void assertAllPointersDisposed() {
    for (Map.Entry<VirtualFilePointerListener, FilePointerPartNode> entry : myPointers.entrySet()) {
      FilePointerPartNode root = entry.getValue();
      ArrayList<FilePointerPartNode> left = new ArrayList<FilePointerPartNode>();
      root.getPointersUnder(null, false, "", left);
      if (!left.isEmpty()) {
        VirtualFilePointerImpl p = left.get(0).leaf;
        try {
          p.throwDisposalError("Not disposed pointer: " + p);
        } finally {
          for (FilePointerPartNode pair : left) {
            VirtualFilePointerImpl pointer = pair.leaf;
            pointer.dispose();
          }
        }
      }
    }

    synchronized (myContainers) {
      if (!myContainers.isEmpty()) {
        VirtualFilePointerContainerImpl container = myContainers.iterator().next();
        container.throwDisposalError("Not disposed container");
      }
    }
  }
 @TestOnly
 public void assertPointersAreDisposed() {
   List<VirtualFilePointerImpl> pointers = new ArrayList<VirtualFilePointerImpl>();
   addAllPointers(pointers);
   try {
     for (VirtualFilePointerImpl pointer : pointers) {
       if (!myStoredPointers.contains(pointer)) {
         pointer.throwDisposalError("Virtual pointer hasn't been disposed: " + pointer);
       }
     }
   } finally {
     myStoredPointers.clear();
   }
 }