Skip to content

Commit aa1f60f

Browse files
Prepare for fix to flutter/flutter#109339. (Baseflow#102)
Currently, in some circumstances where a subclasses of `PlatformInterface` erroneously uses `implements` rather than `extends`, a `NoSuchMethodError` will be thrown (in spite of the documentation at https://pub.dev/documentation/plugin_platform_interface/latest/plugin_platform_interface/PlatformInterface/verify.html claiming that `AssertionError` will be thrown). After flutter/flutter#109339 is fixed, the correct type of exception will be thrown. To avoid a test breakage in `geocoding_platform_interface_test.dart` when the fix happens, we need to modify the test so that it doesn't care what kind of exception is thrown.
1 parent b5f2483 commit aa1f60f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: geocoding_platform_interface/test/geocoding_platform_interface_test.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ void main() {
1919
test('Cannot be implemented with `implements`', () {
2020
expect(() {
2121
GeocodingPlatform.instance = ImplementsGeocodingPlatform();
22-
}, throwsNoSuchMethodError);
22+
// In versions of `package:plugin_platform_interface` prior to fixing
23+
// https://github.com/flutter/flutter/issues/109339, an attempt to
24+
// implement a platform interface using `implements` would sometimes
25+
// throw a `NoSuchMethodError` and other times throw an
26+
// `AssertionError`. After the issue is fixed, an `AssertionError` will
27+
// always be thrown. For the purpose of this test, we don't really care
28+
// what exception is thrown, so just allow any exception.
29+
}, throwsA(anything));
2330
});
2431

2532
test('Can be extended', () {

0 commit comments

Comments
 (0)