aboutsummaryrefslogtreecommitdiff
path: root/app/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/BaseUnitTest.kt36
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/DbFlowTestRule.kt38
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/ImmediateTransactionManager.kt38
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/TestDatabase.kt21
4 files changed, 0 insertions, 133 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/BaseUnitTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/BaseUnitTest.kt
deleted file mode 100644
index 43d6bbf9..00000000
--- a/app/src/test/kotlin/com/pitchedapps/frost/BaseUnitTest.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.pitchedapps.frost
-
-import android.content.Context
-import android.os.Build
-import org.junit.Rule
-import org.junit.runner.RunWith
-import org.robolectric.RobolectricTestRunner
-import org.robolectric.RuntimeEnvironment
-import org.robolectric.annotation.Config
-import timber.log.Timber
-
-/**
- * Created by Allan Wang on 2017-05-30.
- */
-@RunWith(RobolectricTestRunner::class)
-@Config(constants = BuildConfig::class, sdk = intArrayOf(Build.VERSION_CODES.LOLLIPOP),
- assetDir = "build/intermediates/classes/test/")
-abstract class BaseUnitTest {
-
- @JvmField
- @Rule
- var dblflowTestRule = DBFlowTestRule.create()
-
- val context: Context
- get() = RuntimeEnvironment.application
-
- init {
- Timber.plant(TestTree())
- }
-
- internal class TestTree : Timber.Tree() {
- override fun log(priority: Int, tag: String, message: String, t: Throwable?) {
- System.out.println("$tag-$priority: $message")
- }
- }
-}
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/DbFlowTestRule.kt b/app/src/test/kotlin/com/pitchedapps/frost/DbFlowTestRule.kt
deleted file mode 100644
index aaf38a0f..00000000
--- a/app/src/test/kotlin/com/pitchedapps/frost/DbFlowTestRule.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.pitchedapps.frost
-
-import com.raizlabs.android.dbflow.config.DatabaseConfig
-import com.raizlabs.android.dbflow.config.FlowConfig
-import com.raizlabs.android.dbflow.config.FlowManager
-import org.junit.rules.TestRule
-import org.junit.runner.Description
-import org.junit.runners.model.Statement
-import org.robolectric.RuntimeEnvironment
-
-/**
- * Created by Allan Wang on 2017-05-30.
- */
-
-class DBFlowTestRule : TestRule {
-
- override fun apply(base: Statement, description: Description): Statement {
- return object : Statement() {
-
- @Throws(Throwable::class)
- override fun evaluate() {
- FlowManager.init(FlowConfig.Builder(RuntimeEnvironment.application)
- .addDatabaseConfig(DatabaseConfig.Builder(TestDatabase::class.java)
- .transactionManagerCreator(::ImmediateTransactionManager)
- .build()).build())
- try {
- base.evaluate()
- } finally {
- FlowManager.destroy()
- }
- }
- }
- }
-
- companion object {
- fun create() = DBFlowTestRule()
- }
-} \ No newline at end of file
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/ImmediateTransactionManager.kt b/app/src/test/kotlin/com/pitchedapps/frost/ImmediateTransactionManager.kt
deleted file mode 100644
index f3d17e76..00000000
--- a/app/src/test/kotlin/com/pitchedapps/frost/ImmediateTransactionManager.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.pitchedapps.frost
-
-import com.raizlabs.android.dbflow.config.DatabaseDefinition
-import com.raizlabs.android.dbflow.runtime.BaseTransactionManager
-import com.raizlabs.android.dbflow.structure.database.transaction.ITransactionQueue
-import com.raizlabs.android.dbflow.structure.database.transaction.Transaction
-/**
- * Created by Allan Wang on 2017-05-30.
- */
-class ImmediateTransactionManager(databaseDefinition: DatabaseDefinition)
- : BaseTransactionManager(ImmediateTransactionQueue(), databaseDefinition)
-
-
-class ImmediateTransactionQueue : ITransactionQueue {
-
- override fun add(transaction: Transaction?) {
- if (transaction != null) {
- transaction.newBuilder()
- .runCallbacksOnSameThread(true)
- .build()
- .executeSync()
- }
- }
-
- override fun cancel(transaction: Transaction?) {
-
- }
-
- override fun startIfNotAlive() {
- }
-
- override fun cancel(name: String?) {
- }
-
- override fun quit() {
- }
-
-} \ No newline at end of file
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/TestDatabase.kt b/app/src/test/kotlin/com/pitchedapps/frost/TestDatabase.kt
deleted file mode 100644
index 328233ac..00000000
--- a/app/src/test/kotlin/com/pitchedapps/frost/TestDatabase.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.pitchedapps.frost
-
-import com.raizlabs.android.dbflow.annotation.Database
-import com.raizlabs.android.dbflow.annotation.Migration
-import com.raizlabs.android.dbflow.sql.migration.UpdateTableMigration
-
-/**
- * Created by Allan Wang on 2017-05-30.
- */
-
-/**
- * Description:
- */
-@Database(version = TestDatabase.VERSION, name = TestDatabase.NAME)
-object TestDatabase {
-
- const val VERSION = 1
-
- const val NAME = "TestDatabase"
-
-} \ No newline at end of file