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
some context:
In the very beginning of Atrium we were more strict regarding nullability and one was not able to write: expect(nullableInt).toEqual(1) one could only use notToEqualNull and toEqual(null) for nullable subjects. Those two methods were defined on a NullableExpect. i.e. one had to writeexpect(nullableInt).notToBeNull().toEqual(1) instead.
Because we ran into ambiguity issues with expect(listWithNullableElements).inOrder...entries(null, { ... }) we resorted to have only one overload with an nullable assertionCreatorLambda.
By now, we no longer have a NullableExpect and thus we could think about making assertionCreatorOrNull non-nullable and instead force the user to write notToEqualNull in case of a nullable-element inside the assertionCreator.
This would have the advantage, that the null-case does no longer feel alien to the rest.
This has one drawback though. Where one was able to write
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
some context:
In the very beginning of Atrium we were more strict regarding nullability and one was not able to write:
expect(nullableInt).toEqual(1)
one could only usenotToEqualNull
andtoEqual(null)
for nullable subjects. Those two methods were defined on a NullableExpect. i.e. one had to writeexpect(nullableInt).notToBeNull().toEqual(1)
instead.Because we ran into ambiguity issues with expect(listWithNullableElements).inOrder...entries(null, { ... }) we resorted to have only one overload with an nullable assertionCreatorLambda.
By now, we no longer have a NullableExpect and thus we could think about making assertionCreatorOrNull non-nullable and instead force the user to write
notToEqualNull
in case of a nullable-element inside the assertionCreator.This would have the advantage, that the null-case does no longer feel alien to the rest.
This has one drawback though. Where one was able to write
now has to write
We could help out by providing extra overloads for nullable elements something like:
But as long as Kotlin doesn't have lower bounds they would also show up for non-nullable subjects and that would be ugly IMO.
Since this would be a breaking change, we should carefully consider to actually change this.
Beta Was this translation helpful? Give feedback.
All reactions