@@ -55,7 +55,7 @@ import to.bitkit.test.BaseUnitTest
5555
5656@HiltAndroidTest
5757@UninstallModules(DispatchersModule ::class , DbModule ::class )
58- @Config(application = HiltTestApplication ::class )
58+ @Config(application = HiltTestApplication ::class , sdk = [ 34 ]) // Pin Robolectric to an SDK that supports Java 17
5959@RunWith(RobolectricTestRunner ::class )
6060class LightningNodeServiceTest : BaseUnitTest () {
6161
@@ -74,14 +74,14 @@ class LightningNodeServiceTest : BaseUnitTest() {
7474 @BindValue
7575 val cacheStore = mock<CacheStore >()
7676
77- private val handlerCaptor : KArgumentCaptor <NodeEventHandler ?> = argumentCaptor()
77+ private val captor : KArgumentCaptor <NodeEventHandler ?> = argumentCaptor()
7878 private val cacheDataFlow = MutableSharedFlow <AppCacheData >(replay = 1 )
7979 private val context = ApplicationProvider .getApplicationContext<Context >()
8080
8181 @Before
8282 fun setUp () = runBlocking {
8383 hiltRule.inject()
84- whenever(lightningRepo.start(any(), anyOrNull(), any(), anyOrNull(), anyOrNull(), handlerCaptor .capture()))
84+ whenever(lightningRepo.start(any(), anyOrNull(), any(), anyOrNull(), anyOrNull(), captor .capture()))
8585 .thenReturn(Result .success(Unit ))
8686 whenever(lightningRepo.stop()).thenReturn(Result .success(Unit ))
8787
@@ -121,7 +121,7 @@ class LightningNodeServiceTest : BaseUnitTest() {
121121 controller.create().startCommand(0 , 0 )
122122 testScheduler.advanceUntilIdle()
123123
124- val capturedHandler = handlerCaptor .lastValue
124+ val capturedHandler = captor .lastValue
125125 assertNotNull(" Event handler should be captured" , capturedHandler)
126126
127127 val event = Event .PaymentReceived (
@@ -168,7 +168,7 @@ class LightningNodeServiceTest : BaseUnitTest() {
168168 customRecords = emptyList()
169169 )
170170
171- handlerCaptor .lastValue?.invoke(event)
171+ captor .lastValue?.invoke(event)
172172 testScheduler.advanceUntilIdle()
173173
174174 val notificationManager = context.getSystemService(Context .NOTIFICATION_SERVICE ) as NotificationManager
@@ -196,7 +196,7 @@ class LightningNodeServiceTest : BaseUnitTest() {
196196 customRecords = emptyList()
197197 )
198198
199- handlerCaptor .lastValue?.invoke(event)
199+ captor .lastValue?.invoke(event)
200200 testScheduler.advanceUntilIdle()
201201
202202 val notificationManager = context.getSystemService(Context .NOTIFICATION_SERVICE ) as NotificationManager
0 commit comments