algolia / algoliasearch-client-android

Algolia Search API Client for Android
MIT License
99 stars 29 forks source link

refactor(Query): Unify Boolean attributes' handling and testing #552

Closed PLNech closed 6 years ago

PLNech commented 6 years ago

Boolean attributes handling

Although we first thought it would consist in Move Boolean to boolean in the client, exploration showed that we need to stick to Boolean instead:

This means getters should be implemented as public @Nullable Boolean getXXX().

Likewise, the user should be able to unset an attribute's value, putting the Query in its default state for that attribute.

This means setters should be implemented as public @NonNull Query setXXX(@Nullable Boolean xxx);.

This is implemented in 530c577, which refactors setters that were not compliant with this reasoning; and 68a955c, which adds appropriate annotations.

Boolean attributes testing

Testing of our boolean attributes was inconsistent, sometimes testing TRUE and FALSE cases and sometimes only one of them. Adding a test for the null case was an opportunity to refactor those.

I went the following way: