anchor.diff:    });
     when(mockDirectory.createTempSync(any))
       .thenThrow(FileSystemException('', '', OSError('', errorCode)));
  -  when(mockDirectory.createSync(recursive: anyNamed('recursive')))
  -    .thenThrow(FileSystemException('', '', OSError('', errorCode)));
  -  when(mockDirectory.create())
  -    .thenThrow(FileSystemException('', '', OSError('', errorCode)));
  -  when(mockDirectory.createSync())
  -    .thenThrow(FileSystemException('', '', OSError('', errorCode)));
  -  when(mockDirectory.delete())
  -    .thenThrow(FileSystemException('', '', OSError('', errorCode)));
  -  when(mockDirectory.deleteSync())
  -    .thenThrow(FileSystemException('', '', OSError('', errorCode)));
     when(mockDirectory.existsSync())
       .thenThrow(FileSystemException('', '', OSError('', errorCode)));
   }
   
   void main() {
     testWithoutContext('deleteIfExists does not delete if file does not exist', () {
  -    final File file = MockFile();
  -    when(file.existsSync()).thenReturn(false);
  +    final FileSystem fileSystem = MemoryFileSystem.test();
  +    final File file = fileSystem.file('file');
   
       expect(ErrorHandlingFileSystem.deleteIfExists(file), false);
     });
   
     testWithoutContext('deleteIfExists deletes if file exists', () {
  -    final File file = MockFile();
  -    when(file.existsSync()).thenReturn(true);
  +    final FileSystem fileSystem = MemoryFileSystem.test();
  +    final File file = fileSystem.file('file')..createSync();
   
        expect(ErrorHandlingFileSystem.deleteIfExists(file), true);
     });
  
positive.code:     const int kFatalDeviceHardwareError =  483;
      MockFileSystem mockFileSystem;
      ErrorHandlingFileSystem fs;
  
      setUp(() {
        mockFileSystem = MockFileSystem();
  
negative.code: class MockFile extends Mock implements File {}
  class MockFileSystem extends Mock implements FileSystem {}
  class MockDirectory extends Mock implements Directory {}
  
  final Platform windowsPlatform = FakePlatform(
    operatingSystem: 'windows',
  