This file contains hidden or 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
| testOptions { | |
| unitTests { | |
| includeAndroidResources = true | |
| } | |
| } |
This file contains hidden or 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
| @RunWith(AndroidJUnit4::class) | |
| class MainActivityTest { | |
| @get:Rule | |
| val rule = ActivityTestRule(MainActivity::class.java) | |
| @Test | |
| fun testAssertHelloText() { | |
| onView(withId(R.id.hello)).check(matches(withText("Hello World!"))) | |
| } | |
| } |
This file contains hidden or 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
| :app:testDebugUnitTest 12.957s | |
| :app:compileDebugKotlin 1.669s | |
| :app:mergeDebugResources 1.390s | |
| :app:compileDebugUnitTestKotlin 1.055s | |
| :app:compileDebugJavaWithJavac 0.504s | |
| :app:processDebugResources 0.452s | |
| :app:clean 0.168s | |
| :app:preDebugBuild 0.063s | |
| :app:processDebugManifest 0.053s | |
| :app:javaPreCompileDebugUnitTest 0.016s |
This file contains hidden or 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
| val jacocoTestResultTaskName = "jacocoJunit5TestReport" | |
| val junitPlatformTest: JavaExec by tasks | |
| jacoco { | |
| toolVersion = "0.8.2" | |
| applyTo(junitPlatformTest) | |
| } | |
| task<JacocoReport>(jacocoTestResultTaskName) { | |
| group = LifecycleBasePlugin.VERIFICATION_GROUP | |
| description = "Generates code coverage report for the ${junitPlatformTest.name} task." |
This file contains hidden or 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
| gcloud components install cloud-datastore-emulator | |
| gcloud beta emulators datastore start |
This file contains hidden or 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
| class GetPairsImpl(private val pairRepository: PairsRepository) : GetPairs { | |
| override fun get(): List<PairSymbol> { | |
| val list = pairRepository.getPairs() | |
| return if (list.isEmpty()) { | |
| sync() | |
| } else { | |
| pairRepository.getPairs() | |
| } | |
| } |
This file contains hidden or 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
| interface GetPairs { | |
| fun get(): List<PairSymbol> | |
| fun sync(): List<PairSymbol> | |
| } |
This file contains hidden or 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
| class SyncRepositoryImpl<out T : LocalSource<E>, out R : RemoteSource<Q>, Q, E>( | |
| private val db: T, | |
| private val api: R, | |
| private val mapper: Mapper<Q, E> | |
| ) : SyncRepository { | |
| override fun sync() { | |
| api.sync().forEach { | |
| db.save(mapper.map(it)) | |
| } | |
| } |
This file contains hidden or 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
| @ApiMethod(name = "syncTrades", | |
| httpMethod = ApiMethod.HttpMethod.GET, | |
| path = "syncTrades/") | |
| fun sync() = syncService.sync() |
This file contains hidden or 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
| override fun get(): List<PairSymbol> { | |
| val list = pairRepository.getPairs().filter { | |
| it.primarySymbol != "BCH" | |
| } | |
| return if (list.isEmpty()) { | |
| sync() | |
| } else { | |
| pairRepository.getPairs() | |
| } | |
| } |