diff options
author | Allan Wang <me@allanwang.ca> | 2019-01-04 23:59:30 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-01-04 23:59:30 -0500 |
commit | 5d2722b2205e404ee90cbb7e141ac63ca6570e1a (patch) | |
tree | a52744da7d5f18b600a57116f125c9fae5cb1411 /app/src/test/kotlin | |
parent | a1cf58e0eee8d16576380e05a8d87e128242bf05 (diff) | |
download | frost-5d2722b2205e404ee90cbb7e141ac63ca6570e1a.tar.gz frost-5d2722b2205e404ee90cbb7e141ac63ca6570e1a.tar.bz2 frost-5d2722b2205e404ee90cbb7e141ac63ca6570e1a.zip |
Remove unused dependencies and remove reactivex from username fetcher
Diffstat (limited to 'app/src/test/kotlin')
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt | 2 | ||||
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt | 34 |
2 files changed, 1 insertions, 35 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt index ec765448..8610436a 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt @@ -84,7 +84,7 @@ class FbRequestTest { val data = AUTH.getMenuData().invoke() assertNotNull(data) println(ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(data)) - assertTrue(data!!.data.isNotEmpty()) + assertTrue(data.data.isNotEmpty()) assertTrue(data.footer.hasContent, "Footer may be badly parsed") val items = data.flatMapValid() assertTrue(items.size > 15, "Something may be badly parsed") diff --git a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt index 061e7c38..b8d9635a 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt @@ -22,13 +22,10 @@ import com.pitchedapps.frost.facebook.get import com.pitchedapps.frost.facebook.requests.RequestAuth import com.pitchedapps.frost.facebook.requests.getAuth import com.pitchedapps.frost.utils.frostJsoup -import io.reactivex.Completable import org.junit.Assume -import org.junit.Test import java.io.File import java.io.FileInputStream import java.util.Properties -import java.util.concurrent.TimeUnit import kotlin.reflect.full.starProjectedType import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -97,34 +94,3 @@ fun Any.assertComponentsNotEmpty() { fun <T : Comparable<T>> List<T>.assertDescending(tag: String) { assertEquals(sortedDescending(), this, "$tag not sorted in descending order") } - -interface CompletableCallback { - fun onComplete() - fun onError(message: String) -} - -inline fun concurrentTest(crossinline caller: (callback: CompletableCallback) -> Unit) { - val result = Completable.create { emitter -> - caller(object : CompletableCallback { - override fun onComplete() = emitter.onComplete() - override fun onError(message: String) = emitter.onError(Throwable(message)) - }) - }.blockingGet(5, TimeUnit.SECONDS) - if (result != null) - throw RuntimeException("Concurrent fail: ${result.message}") -} - -class InternalTest { - @Test - fun concurrentTest() = try { - concurrentTest { result -> - Thread().run { - Thread.sleep(100) - result.onError("Intentional fail") - } - } - fail("Did not throw exception") - } catch (e: Exception) { - // pass - } -} |