From 752f5a2c457cf6dfb34a7f240d78dc1d92a70f02 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 21 Jun 2017 19:20:56 -0700 Subject: Clean up dependencies --- .../kotlin/com/pitchedapps/frost/BaseUnitTest.kt | 36 -------------------- .../kotlin/com/pitchedapps/frost/DbFlowTestRule.kt | 38 ---------------------- .../frost/ImmediateTransactionManager.kt | 38 ---------------------- .../kotlin/com/pitchedapps/frost/TestDatabase.kt | 21 ------------ 4 files changed, 133 deletions(-) delete mode 100644 app/src/test/kotlin/com/pitchedapps/frost/BaseUnitTest.kt delete mode 100644 app/src/test/kotlin/com/pitchedapps/frost/DbFlowTestRule.kt delete mode 100644 app/src/test/kotlin/com/pitchedapps/frost/ImmediateTransactionManager.kt delete mode 100644 app/src/test/kotlin/com/pitchedapps/frost/TestDatabase.kt (limited to 'app/src/test/kotlin/com/pitchedapps') 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 -- cgit v1.2.3