https://kotlinlang.org logo
#android
Title
# android
a

Adam Kirk

03/25/2019, 2:37 PM
Im having trouble creating a unit test without needing robolectric. I am using AndroidThreeTen.init(this) in my code and when i run my test if I disable robolectric I get an error:
org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered
and if I leave it enabled I get this:
[Robolectric] com.mycomp.,yapp.utilities.log.LogTest.on Calling function w it returns an Int: sdk=28; resources=BINARY
I have tried using testImplementation ‘com.jakewharton.threetenabpthreetenabp1.1.0’ made no difference. I have AndroidThreeTen.init(this) called in my application and testApplication. any ideas? this is my test
Copy code
@Test
    fun `on Calling function i it returns an Int`() {
        assertThat("Returned class is not an Int", Log.i("Test", "Test"), isA(Int::class.java))
        assertThat("Returned Int is not 0", Log.i("Test", "Test"), `is`(0))
    }
Or do I have to use robolectric because of this? (Side note: Log is not the util.log from android but my own class) (edited)
stackoverflow 1
22 Views