diff --git a/test/async_test.dart b/test/async_test.dart index ad52855..d15963d 100644 --- a/test/async_test.dart +++ b/test/async_test.dart @@ -161,7 +161,7 @@ void main() { /// We call [signalReady] before the last has completed expect( () => getIt.signalReady(null), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -222,7 +222,7 @@ void main() { /// We call [signalReady] before the last has completed expect( () => getIt.signalReady(null), - throwsA(const TypeMatcher()), + throwsStateError, ); }); test('all ready ignoring pending async Singletons', () async { @@ -396,7 +396,7 @@ void main() { instanceName: 'Second Instance', ); - expect(getIt.allReady(), throwsA(isA())); + expect(getIt.allReady(), throwsStateError); }); test('ready manual synchronisation of sequence', () async { final getIt = GetIt.instance; @@ -639,7 +639,7 @@ void main() { try { await getIt.allReady(timeout: const Duration(seconds: 1)); } catch (ex) { - expect(ex, const TypeMatcher()); + expect(ex, isA()); final timeOut = ex as WaitingTimeOutException; expect(timeOut.notReadyYet.contains('null : TestClass'), true); expect(timeOut.notReadyYet.contains('null : TestClass2'), true); @@ -666,7 +666,7 @@ void main() { ); final instance = await getIt.getAsync(); - expect(instance, const TypeMatcher()); + expect(instance, isA()); }); test('register factory with one Param', () async { @@ -765,7 +765,7 @@ void main() { expect( () => getIt.getAsync(param1: 'abc', param2: '3'), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }); @@ -781,7 +781,7 @@ void main() { expect( () => getIt.getAsync(), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }); @@ -795,7 +795,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }); @@ -810,7 +810,7 @@ void main() { await Future.delayed(const Duration(microseconds: 1)); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -823,7 +823,7 @@ void main() { ); final instance = await getIt.getAsync(); - expect(instance, const TypeMatcher()); + expect(instance, isA()); }); test('asyncLazySingleton called with get after wait for ready', () async { @@ -838,7 +838,7 @@ void main() { await getIt.isReady(timeout: const Duration(milliseconds: 20)); final instance2 = getIt.get(); - expect(instance2, const TypeMatcher()); + expect(instance2, isA()); }); test('isReady called on asyncLazySingleton ', () async { @@ -852,7 +852,7 @@ void main() { await getIt.isReady(timeout: const Duration(milliseconds: 20)); final instance = getIt.get(); - expect(instance, const TypeMatcher()); + expect(instance, isA()); }); group("dependency", () { diff --git a/test/get_it_test.dart b/test/get_it_test.dart index 3077731..fcadac5 100644 --- a/test/get_it_test.dart +++ b/test/get_it_test.dart @@ -180,7 +180,7 @@ void main() { expect( () => getIt.get(param1: 'abc', param2: '3'), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }); @@ -195,7 +195,7 @@ void main() { expect( () => getIt.get(param2: '3'), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }); @@ -251,7 +251,7 @@ void main() { await getIt.reset(); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(destructorCounter, 1); @@ -266,7 +266,7 @@ void main() { await getIt.reset(); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(disposeCounter, 1); @@ -343,7 +343,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); GetIt.I.reset(); @@ -442,7 +442,7 @@ void main() { expect( () => getIt(instanceName: 'not there'), - throwsA(const TypeMatcher()), + throwsA(isA()), ); GetIt.I.reset(); }); @@ -702,7 +702,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -738,7 +738,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -773,7 +773,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -808,7 +808,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -839,7 +839,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); test('testing reference counting', () async { @@ -880,7 +880,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); test('testing reference counting - unregister', () async { @@ -921,7 +921,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -949,15 +949,15 @@ void main() { expect( () => getIt(instanceName: 'instanceName'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( getIt(instanceName: 'instanceName2'), - const TypeMatcher(), + isA(), ); expect( getIt(instanceName: 'instanceName'), - const TypeMatcher(), + isA(), ); }); @@ -984,7 +984,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -1011,7 +1011,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -1040,7 +1040,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -1061,7 +1061,7 @@ void main() { expect( () => getIt(instanceName: 'instanceName'), - throwsA(const TypeMatcher()), + throwsStateError, ); }); test('change registration name with type and name', () async { @@ -1083,11 +1083,11 @@ void main() { expect( () => getIt(instanceName: 'instanceName'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( getIt(instanceName: 'instanceName2'), - const TypeMatcher(), + isA(), ); }); @@ -1108,7 +1108,7 @@ void main() { newInstanceName: 'instanceNameExisting', ); }, - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -1131,11 +1131,11 @@ void main() { expect( () => getIt(instanceName: 'instanceName'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( getIt(instanceName: 'instanceName2'), - const TypeMatcher(), + isA(), ); }); @@ -1196,7 +1196,7 @@ void main() { final Injector instance = GetIt.I(); - expect(instance, const TypeMatcher()); + expect(instance, isA()); }); test('deregister in the same order of registering', () async { @@ -1257,7 +1257,7 @@ void main() { expect( () => getIt(), - throwsA(const TypeMatcher()), + throwsStateError, ); await getIt.unregister(); diff --git a/test/scope_test.dart b/test/scope_test.dart index 40fe675..7971550 100644 --- a/test/scope_test.dart +++ b/test/scope_test.dart @@ -82,7 +82,7 @@ void main() { getIt.unregister(); - expect(() => getIt.get(), throwsA(isA())); + expect(() => getIt.get(), throwsStateError); }); test('register constant in two scopes', () { @@ -358,7 +358,7 @@ void main() { expect(instanceTestClassScope1.id, 'Basescope'); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -387,7 +387,7 @@ void main() { expect(instanceTestClassScope1.id, 'Basescope'); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); test('popscopeuntil inclusive=false', () async { @@ -415,7 +415,7 @@ void main() { expect(instanceTestClassScope1.id, '2. scope'); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); }); @@ -477,7 +477,7 @@ void main() { test('popscope throws if already on the base scope', () async { final getIt = GetIt.instance; - expect(() => getIt.popScope(), throwsA(const TypeMatcher())); + expect(() => getIt.popScope(), throwsStateError); }); test('dropScope', () async { @@ -504,7 +504,7 @@ void main() { expect(instanceTestClassScope1.id, 'Basescope'); expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); final instanceTestClass3Scope3 = getIt.get(); @@ -517,7 +517,7 @@ void main() { getIt.pushNewScope(scopeName: 'scope2'); await expectLater( () => getIt.dropScope('scope'), - throwsA(const TypeMatcher()), + throwsA(isA()), ); }); @@ -541,7 +541,7 @@ void main() { expect( () => getIt.get(), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(getIt.get(), isNotNull); }); @@ -584,7 +584,7 @@ void main() { expect(getIt(instanceName: 'scope2'), isNotNull); expect( () => getIt.get(instanceName: 'scope3'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(disposeCounter, 2); @@ -635,7 +635,7 @@ void main() { expect(getIt(instanceName: 'scope2'), isNotNull); expect( () => getIt.get(instanceName: 'scope3'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(disposeCounter, 0); @@ -682,19 +682,19 @@ void main() { expect( () => getIt.get(instanceName: 'scope0'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( () => getIt.get(instanceName: 'scope1'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( () => getIt.get(instanceName: 'scope2'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( () => getIt.get(instanceName: 'scope3'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(disposeCounter, 7); @@ -759,19 +759,19 @@ void main() { expect( () => getIt.get(instanceName: 'scope0'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( () => getIt.get(instanceName: 'scope1'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( () => getIt.get(instanceName: 'scope2'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect( () => getIt.get(instanceName: 'scope3'), - throwsA(const TypeMatcher()), + throwsStateError, ); expect(disposeCounter, 0);