You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
For 3DS integration, our code uses the respective SDK Action class implementations: RedirectAction, Threeds2FingerprintAction, Threeds2ChallengeAction (ofc).
In our tests, using Mockito / Mockito-Kotlin, we usually verify that certain methods are invoked with specific instances of classes to assert behaviour of our components. Such only work if the type of method arguments are implementing equals. Since we're using Kotlin and data classes, that's granted.
But for aforementioned Action implementations, we can't do such verifications since these classes do not implement equals, even though they are pretty much like data classes.
Describe the solution you'd like
Let's implement equals in Action descendants.
Additional context
Some sample (pseudo) code:
We have a ViewModel with a LiveData:
class MyViewModel {
val command = MutableLiveData<Action>()
}
Test code mocks an observer to be used to verify LiveData emissions.
val viewModel = MyViewModel()
val observer: Observer<Action> = mock()
viewModel.command.observeForever(observer)
Then test code calls actions on ViewModel to make it emit expected objects and verify such emissions
// when
viewModel.someAction()
// then
val expectedAction = RedirectAction().apply { ... }
verify(observer).onChanged(expectedAction)
The text was updated successfully, but these errors were encountered:
Thx for the suggestion, we will try to work on that for the next releases.
In the meantime, maybe you can use the serialised version of the objects and check equality of the result string?
Like Action.SERIALIZER.serialize(action).toString()
Is your feature request related to a problem? Please describe.
For 3DS integration, our code uses the respective SDK
Action
class implementations:RedirectAction
,Threeds2FingerprintAction
,Threeds2ChallengeAction
(ofc).In our tests, using Mockito / Mockito-Kotlin, we usually verify that certain methods are invoked with specific instances of classes to assert behaviour of our components. Such only work if the type of method arguments are implementing
equals
. Since we're using Kotlin and data classes, that's granted.But for aforementioned
Action
implementations, we can't do such verifications since these classes do not implementequals
, even though they are pretty much like data classes.Describe the solution you'd like
Let's implement equals in
Action
descendants.Additional context
Some sample (pseudo) code:
We have a ViewModel with a LiveData:
Test code mocks an observer to be used to verify LiveData emissions.
Then test code calls actions on ViewModel to make it emit expected objects and verify such emissions
The text was updated successfully, but these errors were encountered: