Unregister network callback in tearDown

Representing networkCallback as a non-null lateinit var and using
property isInitialized seems more appropriate than making
networkCallback nullable. Making networkCallback nullable would require
null checks / safe calls for every use. However, from the tests'
perspective networkCallback cannot be null; the only concern is
tearDown() which has to deal with early exits from setUp() due to
assumption / assertion failures and therefore partially initialized
state.

networkCallback can only be initialized when requestNetwork() is called
as unregisterNetworkCallback() will throw an exception if the callback
was never registered.

Test: TH
Change-Id: I2aad7d781e6955b29d505e670181209c33db7680
1 file changed