-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from kitakkun/feature/fix_android_test_fails
Fix Android Tests
- Loading branch information
Showing
9 changed files
with
54 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
...roidDebugUnitTest/kotlin/io/github/kitakkun/backintime/test/BackInTimeDebugServiceTest.kt
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...c/androidUnitTest/kotlin/io/github/kitakkun/backintime/test/BackInTimeDebugServiceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.github.kitakkun.backintime.test | ||
|
||
import io.github.kitakkun.backintime.runtime.BackInTimeDebugService | ||
import io.github.kitakkun.backintime.runtime.getBackInTimeDebugService | ||
import io.github.kitakkun.backintime.runtime.internal.BackInTimeCompilerInternalApi | ||
import io.github.kitakkun.backintime.test.base.MockConnector | ||
import io.github.kitakkun.backintime.websocket.event.BackInTimeDebugServiceEvent | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
import kotlin.test.AfterTest | ||
import kotlin.test.BeforeTest | ||
|
||
/** | ||
* copy of BackInTimeDebugServiceTest.kt in jvmTest | ||
*/ | ||
@RunWith(RobolectricTestRunner::class) | ||
abstract class BackInTimeDebugServiceTest { | ||
@OptIn(BackInTimeCompilerInternalApi::class) | ||
private val service: BackInTimeDebugService = getBackInTimeDebugService(useInUnitTest = true) | ||
private val mockConnector = MockConnector() | ||
private val events: List<BackInTimeDebugServiceEvent> get() = mockConnector.eventsFromService | ||
|
||
val registerInstanceEvents get() = events.filterIsInstance<BackInTimeDebugServiceEvent.RegisterInstance>() | ||
val propertyValueChangeEvents get() = events.filterIsInstance<BackInTimeDebugServiceEvent.NotifyValueChange>() | ||
val methodCallEvents get() = events.filterIsInstance<BackInTimeDebugServiceEvent.NotifyMethodCall>() | ||
val registerRelationShipEvents get() = events.filterIsInstance<BackInTimeDebugServiceEvent.RegisterRelationship>() | ||
|
||
@BeforeTest | ||
fun setup() { | ||
service.setConnector(mockConnector) | ||
service.startService() | ||
} | ||
|
||
@AfterTest | ||
fun teardown() { | ||
service.stopService() | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters