commonTest.Test.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of instantsearch-core Show documentation
Show all versions of instantsearch-core Show documentation
InstantSearch Android is a library providing widgets and helpers to help you build the best instant-search experience on Android with Algolia. It is built on top of Algolia's Kotlin API Client to provide you a high-level solution to quickly build various search interfaces.
import kotlin.reflect.KClass
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertFalse
import kotlin.test.assertNotEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.assertTrue
internal infix fun T.shouldEqual(expected: T) {
assertEquals(expected, this)
}
internal infix fun T.shouldNotEqual(expected: T) {
assertNotEquals(expected, this)
}
internal fun Any?.shouldBeNull() {
assertNull(this)
}
internal fun Any?.shouldNotBeNull() {
assertNotNull(this)
}
internal fun Boolean.shouldBeTrue() {
assertTrue(this)
}
internal fun Boolean.shouldBeFalse() {
assertFalse(this)
}
internal infix fun Collection.shouldEqual(collection: Collection) {
assertEquals(collection, this)
}
internal infix fun Collection.shouldNotEqual(collection: Collection) {
assertNotEquals(collection, this)
}
internal fun Collection.shouldBeEmpty() {
this.isEmpty().shouldBeTrue()
}
internal fun Collection.shouldNotBeEmpty() {
this.isNotEmpty().shouldBeTrue()
}
internal infix fun Collection.shouldContain(element: T) {
this.contains(element)
}
internal infix fun KClass.shouldFailWith(block: suspend () -> Unit): T {
return assertFailsWith(this, null) {
blocking {
block()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy