Quantcast
Channel: Active questions tagged use-case - Stack Overflow
Viewing all articles
Browse latest Browse all 80

How to mock void parameter in use case

$
0
0

I do have the next Use Case

class GetLessonsUseCase extends UseCase<List<LessonEntity>, void> {  final LessonsRepository _repository;  GetLessonsUseCase(this._repository);  @override  Future<List<LessonEntity>> call({void params}) async {    return _repository.getLessons();  }}

and the problem is that mockito generates the next code with error

// A class which mocks [GetLessonsUseCase].////// See the documentation for Mockito's code generation for more information.class MockGetLessonsUseCase extends _i1.Mock implements _i9.GetLessonsUseCase {  @override  _i3.Future<List<_i4.LessonEntity>> call({void params}) => (super.noSuchMethod(        Invocation.method(          #call,          [],          {#params: params},        ),        returnValue: Future<List<_i4.LessonEntity>>.value(<_i4.LessonEntity>[]),      ) as _i3.Future<List<_i4.LessonEntity>>);}

generated error

I tried to declare it with returnNullOrMissing, but still not working

@GenerateMocks([  LessonsRepository,  // GetLessonsUseCase,  SetDrawerBadgesUseCase,  GetYoutubeIconUseCase,], customMocks: [  MockSpec<GetLessonsUseCase>(returnNullOnMissingStub: true),])

Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>