Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 5.4.1-dev
## 5.4.1-wip

* Deprecate the `mixingIn` argument to `MockSpec`. Best practice is to avoid
any concrete implementation in classes which extend `Mock`.
Expand Down
34 changes: 17 additions & 17 deletions lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1380,15 +1380,7 @@ class _MockClassInfo {
returnType.containsPrivateName ||
parametersContainPrivateName);

if (throwsUnsupported) {
if (!mockTarget.unsupportedMembers.contains(name)) {
// We shouldn't get here as this is guarded against in
// [_MockTargetGatherer._checkFunction].
throw InvalidMockitoAnnotationException(
"Mockito cannot generate a valid override for '$name', as it has a "
'non-nullable unknown return type or a private type in its '
'signature.');
}
if (mockTarget.unsupportedMembers.contains(name)) {
builder.body = refer('UnsupportedError')
.call([
// Generate a raw string since name might contain a $.
Expand All @@ -1400,6 +1392,14 @@ class _MockClassInfo {
.code;
return;
}
if (throwsUnsupported) {
// We shouldn't get here as this is guarded against in
// [_MockTargetGatherer._checkFunction].
throw InvalidMockitoAnnotationException(
"Mockito cannot generate a valid override for '$name', as it has a "
'non-nullable unknown return type or a private type in its '
'signature.');
}

final invocation =
referImported('Invocation', 'dart:core').property('method').call([
Expand Down Expand Up @@ -1881,14 +1881,7 @@ class _MockClassInfo {
returnType is analyzer.TypeParameterType;
final throwsUnsupported = fallbackGenerator == null &&
(returnTypeIsTypeVariable || getter.returnType.containsPrivateName);
if (throwsUnsupported) {
if (!mockTarget.unsupportedMembers.contains(getter.name)) {
// We shouldn't get here as this is guarded against in
// [_MockTargetGatherer._checkFunction].
throw InvalidMockitoAnnotationException(
"Mockito cannot generate a valid override for '${getter.name}', as "
'it has a non-nullable unknown type or a private type.');
}
if (mockTarget.unsupportedMembers.contains(getter.name)) {
builder.body = refer('UnsupportedError')
.call([
// Generate a raw string since getter.name might contain a $.
Expand All @@ -1901,6 +1894,13 @@ class _MockClassInfo {
.code;
return;
}
if (throwsUnsupported) {
// We shouldn't get here as this is guarded against in
// [_MockTargetGatherer._checkFunction].
throw InvalidMockitoAnnotationException(
"Mockito cannot generate a valid override for '${getter.name}', as "
'it has a non-nullable unknown type or a private type.');
}

final invocation =
referImported('Invocation', 'dart:core').property('getter').call([
Expand Down
3 changes: 1 addition & 2 deletions lib/src/mock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

import 'dart:async';

import 'package:matcher/expect.dart';
import 'package:meta/meta.dart';
import 'package:mockito/src/call_pair.dart';
import 'package:mockito/src/invocation_matcher.dart';
// ignore: deprecated_member_use
import 'package:test_api/fake.dart';
// ignore: deprecated_member_use
import 'package:test_api/test_api.dart';

/// Whether a [when] call is "in progress."
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const packageVersion = '5.4.1-dev';
const packageVersion = '5.4.1-wip';
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mockito
version: 5.4.1-dev
version: 5.4.1-wip
description: >-
A mock framework inspired by Mockito with APIs for Fakes, Mocks,
behavior verification, and stubbing.
Expand All @@ -18,7 +18,7 @@ dependencies:
meta: ^1.3.0
path: ^1.8.0
source_gen: '>=0.9.6 <2.0.0'
test_api: '>=0.2.1 <0.6.0'
test_api: '>=0.2.1 <0.7.0'

dev_dependencies:
build_runner: ^2.0.0
Expand Down