I have such a JUnit test:
Test fun testCategoriesLoading() { val subscriber = TestSubscriber<List<ACategory>>() service.categories().subscribe(subscriber) subscriber.awaitTerminalEvent() subscriber.assertNoErrors() }
service Retrofit that uses GsonConverter to deserialize json in
data class ACategory(val id: String, val title: String, val parentId: String?, val hasChildren: Boolean)
copies.
The test passes even if the ACategory is filled with id = null, title = null, etc.
So, as far as I know, gson using reflection and kotlin lazily solve these uncertainty constraints on first access.
Is there any way to force this solution? Some nice solution without direct access to the fields manually? I really do not want to write each statement manually.
source share