Closed ghost closed 2 years ago
This exception can be found in the _FakeRx, _FakeRxList and _FakeRxBool
'Object.==' ('bool Function(Object)') isn't a valid concrete implementation of 'RxObjectMixin.==' ('bool Function(dynamic)').
I suspect this problem is fixed in a recent version of get
. At HEAD, you can see that RxObjectMixin.== accepts an Object instead of dynamic: https://github.com/jonataslaw/getx/blob/master/lib/get_rx/src/rx_types/rx_core/rx_impl.dart#L84
implements _i3._InternalFinalCallback
{}
Ouch, mockito should definitely throw rather than generate this code. In any case, the problem is that GlucoseController has methods which seem to reference private types: get onStart
and get onDelete
return _InternalFinalCallback<void>
which we can't mock...
You might be able to get around this shortcoming by specifying your own fallback generators (in customMocks
for these two methods. These are a new API so not documented super well. You can find an example in the tests.
Indeed it looks like the get authors do not want GetLifeCycle to be subclassed, as per onStart:
It uses an internal "callable" type, to avoid any
@overrides
in subclases. This method should be internal and is required to define the lifetime cycle of the subclass.
I understand that you are likely not overriding the getter, but mockito needs to, in order to return a non-null value.
The changes related to this issue broke quite a few of my mocks which previously worked. I understand that I probably have not used the broken generated methods and that is why they work. But this is likely a breaking change for a lot of projects and should not be patch version.
@kuhnroyal You may have responded to the wrong issue. I don't see how your comments relate to this issue...
The changes related to this issue broke
What changes?
But this is likely a breaking change
What is?
You linked it in the changelog for 5.0.17 - in any case, that version breaks builds and it looks like this fits as I suddenly have invalid mocks.
Ah I understand. Thanks for the info. Can you please file an issue with the problem with a reproduction case? Including the mocks-in-question generated by 5.0.16 and the error reported by 5.0.17 would be very helpful. Thanks!
solution for this issue?
I am getting two exception in the GeneratedMock file:
This exception can be found in the _FakeRx, _FakeRxList and _FakeRxBool
'Object.==' ('bool Function(Object)') isn't a valid concrete implementation of 'RxObjectMixin.==' ('bool Function(dynamic)').
This exception is given for _i3._InternalFinalCallback
Classes and mixins can only implement other classes. Try specifying a class or mixin, or remove the name from the list.
How would you solve this issue and why am I getting it? (Sorry if it is something obvious, first time using mockito and getx )
Full code: