我正在尝试运行一个测试:
@HiltAndroidTest
class ActionDaoTest {
@get : Rule
var hiltRule = HiltAndroidRule(this)
@get : Rule
var instantTaskExecutorRule = InstantTaskExecutorRule()
@Inject
@Named("test_db")
lateinit var database: MyDatabase
private lateinit var actionDao: ActionDao
@Before
fun setup() {
hiltRule.inject()
actionDao = database.actionDao()
}
@After
fun teardown(){
database.close()
}
@Test
fun insert_assetTrue() = runTest{
val action = ActionEntity("name","description", LocalDate.now())
actionDao.insert(action)
val actionList= actionDao.selectAll().first()
assertThat(actionList).contains(action)
}
我遇到了一个错误:
java.lang.NoSuchMethodError:在类Lkotlinx/coroutines/internal/ThreadSafeHeap或其超类中找不到名为find(Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/internal/ThreadSafeHeapNode的虚拟方法