anchor.diff:      });
   
       testWithoutContext('when the file is being used by another program', () async {
  -      setupWriteMocks(
  -        mockFileSystem: mockFileSystem,
  -        fs: fs,
  -        errorCode: kUserMappedSectionOpened,
  -      );
  -
  -      final File file = fs.file('file');
  +      final ErrorHandlingFileSystem fileSystem = ErrorHandlingFileSystem(
  +        delegate: MemoryFileSystem.test(opHandle: exceptionHandler.opHandle),
  +        platform: windowsPlatform,
  +      );
  +      final File file = fileSystem.file('file');
  +
  +      exceptionHandler.addError(
  +        file,
  +        FileSystemOp.write,
  +        FileSystemException('', file.path, const OSError('', kUserMappedSectionOpened)),
  +      );
   
         const String expectedMessage = 'The file is being used by another program';
         expect(() async => file.writeAsBytes(<int>[0]),
  
positive.code:     });
  
      testWithoutContext('when the device driver has a fatal error', () async {
        setupWriteMocks(
          mockFileSystem: mockFileSystem,
          fs: fs,
          errorCode: kFatalDeviceHardwareError,
        );
  
        final File file = fs.file('file');
  
        const String expectedMessage = 'There is a problem with the device driver '
          'that this file or directory is stored on';
  
negative.code:   operatingSystem: 'macos',
    environment: <String, String>{}
  );
  
  void setupReadMocks({
    FileSystem mockFileSystem,
  