Skip to content

When mockito/annotations fails to create a mock it would be good to know what class was trying to be mocked and where in the source code this class was added to be mocked #540

Closed
@apwilson

Description

@apwilson

When mockito/annotations fails to make mocks for one reason or another it's often not clear which mocks it failed to create. You instead get some cryptic stuff like this:

Invalid @GenerateMocks annotation: Mockito cannot generate a valid override for method '<redacted>'; parameter '<redacted>' causes a problem: default value has a private type: asset:<redacted>#<redacted>.
package:mockito/src/builder.dart 1348:11                   _MockClassInfo._matchingParameter.<fn>
package:code_builder/src/specs/method.g.dart 641:33        _$ParameterBuilder.update
package:code_builder/src/specs/method.g.dart 403:32        new _$Parameter
package:mockito/src/builder.dart 1334:12                   _MockClassInfo._matchingParameter
package:mockito/src/builder.dart 1061:35                   _MockClassInfo._buildOverridingMethod
package:mockito/src/builder.dart 1016:36                   _MockClassInfo.methodOverrides.<fn>
package:code_builder/src/specs/method.g.dart 332:33        _$MethodBuilder.update
package:code_builder/src/specs/method.g.dart 38:29         new _$Method
package:mockito/src/builder.dart 1016:15                   _MockClassInfo.methodOverrides
dart:core                                                  List.addAll
package:built_collection/src/list/list_builder.dart 98:14  ListBuilder.addAll
package:mockito/src/builder.dart 941:14                    _MockClassInfo._buildMockClass.<fn>
package:code_builder/src/specs/class.g.dart 292:33         _$ClassBuilder.update
package:code_builder/src/specs/class.g.dart 34:28          new _$Class
package:mockito/src/builder.dart 886:12                    _MockClassInfo._buildMockClass
package:mockito/src/builder.dart 836:9                     new _MockLibraryInfo
package:mockito/src/builder.dart 74:29                     MockBuilder.build
===== asynchronous gap ===========================
package:build/src/generate/run_builder.dart 52:7           runBuilder.buildForInput

But it's not clear what the class attempting to mocked is or what file or line number. All would be helpful.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ontype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions