In Java variation of Mockito exists:
when( userProfileEntity.getFullName() ).thenCallRealMethod();
Is there anything similar for Flutter/Dart?
Created by myself - https://pub.dev/packages/dart_class_wrapper
// sample_test.dart
import 'sample.dart';
@GenerateWithMethodSetters([Sample])
import 'main.wrapper.dart';
void main() {
test('Wrap connection', () {
final obj = WrapperSample();
obj.mockIsConnected = () => true;
expect(obj.get(), 10);
obj.mockIsConnected = () => false;
expect(obj.get(), null);
});
}
// sample.dart
class Sample {
Sample();
bool isConnected() {
throw Exception('Emulate connection');
}
double? get() {
if (isConnected()) {
return 10;
}
return null;
}
}