Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / locationprovider / src / test / java / com / android / location / provider / GeocoderParamsJvmTest.kt
GeocoderParamsJvmTest.kt24 lines · 855 BRaw
| 1 | package com.android.location.provider |
| 2 | |
| 3 | import android.location.GeocoderParams |
| 4 | import kotlin.test.Test |
| 5 | import kotlin.test.assertEquals |
| 6 | import kotlin.test.assertFailsWith |
| 7 | |
| 8 | /** |
| 9 | * Plain-JVM (no Robolectric): the `android.location` package is loaded from |
| 10 | * the boot classpath under Robolectric, which shadows this module's stub. |
| 11 | * On a plain classpath the module class wins, so its stub contract is |
| 12 | * directly observable here. |
| 13 | */ |
| 14 | class GeocoderParamsJvmTest { |
| 15 | |
| 16 | @Test |
| 17 | fun geocoderParamsAccessorsThrowStub() { |
| 18 | val ctor = GeocoderParams::class.java.getDeclaredConstructor() |
| 19 | ctor.isAccessible = true |
| 20 | val params = ctor.newInstance() |
| 21 | assertEquals("stub", assertFailsWith<RuntimeException> { params.locale }.message) |
| 22 | assertEquals("stub", assertFailsWith<RuntimeException> { params.clientPackage }.message) |
| 23 | } |
| 24 | } |