import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_smartscan_plugin/flutter_smartscan_plugin.dart'; import 'package:flutter_smartscan_plugin/flutter_smartscan_plugin_platform_interface.dart'; import 'package:flutter_smartscan_plugin/plugin_method_channel_native.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; class MockFlutterSmartscanPluginPlatform with MockPlatformInterfaceMixin implements FlutterSmartscanPluginPlatform { @override Future getPlatformVersion() => Future.value('42'); } void main() { final FlutterSmartscanPluginPlatform initialPlatform = FlutterSmartscanPluginPlatform.instance; test('$MethodChannelFlutterSmartscanPlugin is the default instance', () { expect( initialPlatform, isInstanceOf()); }); test('getPlatformVersion', () async { FlutterSmartscanPlugin flutterSmartscanPlugin = FlutterSmartscanPlugin(); MockFlutterSmartscanPluginPlatform fakePlatform = MockFlutterSmartscanPluginPlatform(); FlutterSmartscanPluginPlatform.instance = fakePlatform; expect(await flutterSmartscanPlugin.getPlatformVersion(), '42'); }); }