How to use anyVararg method of org.mockito.kotlin.Matchers class

Best Mockito-kotlin code snippet using org.mockito.kotlin.Matchers.anyVararg

RecurrenceFormatterTest.kt

Source:RecurrenceFormatterTest.kt Github

copy

Full Screen

...20import com.maltaisn.recurpicker.Recurrence21import com.maltaisn.recurpicker.Recurrence.Period22import com.maltaisn.recurpicker.dateFor23import com.nhaarman.mockitokotlin2.any24import com.nhaarman.mockitokotlin2.anyVararg25import com.nhaarman.mockitokotlin2.eq26import com.nhaarman.mockitokotlin2.mock27import com.nhaarman.mockitokotlin2.whenever28import org.junit.Before29import org.junit.Test30import org.junit.runner.RunWith31import org.mockito.ArgumentMatchers.anyInt32import org.mockito.Mock33import org.mockito.junit.MockitoJUnitRunner34import java.text.SimpleDateFormat35import java.util.Locale36import kotlin.test.assertEquals37import kotlin.test.assertFailsWith38@RunWith(MockitoJUnitRunner::class)39class RecurrenceFormatterTest {40 @Mock41 private lateinit var context: Context42 private lateinit var recurFormat: RecurrenceFormatter43 @Before44 fun setUp() {45 val resources: Resources = mock()46 whenever(context.resources).thenReturn(resources)47 // Mock all format strings, plurals and arrays used.48 // Note that plurals are ignored so test assert for values like "Every 1 days".49 whenever(resources.getStringArray(R.array.rp_days_of_week_abbr3)).thenReturn(50 arrayOf("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"))51 whenever(resources.getString(R.string.rp_format_none)).thenReturn("Does not repeat")52 whenever(resources.getQuantityString(eq(R.plurals.rp_format_day), anyInt(),53 anyVararg())).thenAnswer { "Every ${it.arguments[2]} days" }54 whenever(resources.getQuantityString(eq(R.plurals.rp_format_week), anyInt(),55 anyVararg())).thenAnswer { "Every ${it.arguments[2]} weeks" }56 whenever(resources.getQuantityString(eq(R.plurals.rp_format_month), anyInt(),57 anyVararg())).thenAnswer { "Every ${it.arguments[2]} months" }58 whenever(resources.getQuantityString(eq(R.plurals.rp_format_year), anyInt(),59 anyVararg())).thenAnswer { "Every ${it.arguments[2]} years" }60 whenever(resources.getString(eq(R.string.rp_format_weekly_option),61 any())).thenAnswer { "on ${it.arguments[1]}" }62 whenever(resources.getString(R.string.rp_format_weekly_all)).thenReturn("every day of the week")63 whenever(resources.getString(R.string.rp_format_monthly_same_day)).thenReturn("on the same day each month")64 whenever(resources.getString(R.string.rp_format_monthly_last_day)).thenReturn("on the last day of the month")65 whenever(resources.getStringArray(R.array.rp_format_monthly_same_week)).thenReturn(66 arrayOf("on every %s Sunday", "", "", "", "", "", ""))67 whenever(resources.getStringArray(R.array.rp_format_monthly_ordinal)).thenReturn(68 arrayOf("first", "second", "third", "fourth", "last"))69 whenever(resources.getString(eq(R.string.rp_format_end_date), any())).thenAnswer { "until ${it.arguments[1]}" }70 whenever(resources.getQuantityString(eq(R.plurals.rp_format_end_count), anyInt(),71 anyVararg())).thenAnswer { "for ${it.arguments[2]} events" }72 recurFormat = RecurrenceFormatter(SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH))73 }74 @Test75 fun `should format 'does not repeat' recurrence`() {76 val r = Recurrence.DOES_NOT_REPEAT77 assertEquals("Does not repeat", recurFormat.format(context, r))78 }79 @Test80 fun `should format daily recurrence`() {81 val r = Recurrence(Period.DAILY)82 assertEquals("Every 1 days", recurFormat.format(context, r))83 }84 @Test85 fun `should format default weekly recurrence`() {...

Full Screen

Full Screen

CouponsListViewModelTests.kt

Source:CouponsListViewModelTests.kt Github

copy

Full Screen

...15import org.assertj.core.api.Assertions.assertThat16import org.junit.Test17import org.mockito.ArgumentMatchers.anyBoolean18import org.mockito.kotlin.any19import org.mockito.kotlin.anyVararg20import org.mockito.kotlin.clearInvocations21import org.mockito.kotlin.doAnswer22import org.mockito.kotlin.doReturn23import org.mockito.kotlin.doSuspendableAnswer24import org.mockito.kotlin.mock25import org.mockito.kotlin.verify26import org.mockito.kotlin.whenever27import org.wordpress.android.fluxc.model.SiteModel28import org.wordpress.android.fluxc.store.WooCommerceStore29class CouponsListViewModelTests : BaseUnitTest() {30 private lateinit var viewModel: CouponListViewModel31 private val defaultCouponsList = (1L..10L).map {32 CouponTestUtils.generateTestCoupon(it)33 }34 private val couponsStateFlow = MutableStateFlow(emptyList<Coupon>())35 private val couponListHandler: CouponListHandler = mock {36 on { couponsFlow } doReturn couponsStateFlow37 }38 private val wooCommerceStore: WooCommerceStore = mock()39 private val currencyFormatter: CurrencyFormatter = mock()40 private val resourceProvider: ResourceProvider = mock {41 on { getString(any()) } doAnswer { it.arguments[0].toString() }42 on { getString(any(), anyVararg()) } doAnswer { it.arguments[0].toString() }43 }44 private val couponUtils = CouponUtils(45 currencyFormatter = currencyFormatter,46 resourceProvider = resourceProvider47 )48 suspend fun setup(prepareMocks: suspend () -> Unit = {}) {49 prepareMocks()50 viewModel = CouponListViewModel(51 savedState = SavedStateHandle(),52 wooCommerceStore = wooCommerceStore,53 couponListHandler = couponListHandler,54 couponUtils = couponUtils,55 selectedSite = mock {56 on { get() } doReturn SiteModel()...

Full Screen

Full Screen

GoogleDriveClientTest.kt

Source:GoogleDriveClientTest.kt Github

copy

Full Screen

...9import com.github.proyeception.benito.mock.eq10import com.github.proyeception.benito.mock.getMock11import com.github.proyeception.benito.mock.on12import com.github.proyeception.benito.utils.FileHelper13import com.nhaarman.mockito_kotlin.anyVararg14import io.kotlintest.matchers.shouldBe15import org.mockito.ArgumentMatchers.any16import org.mockito.ArgumentMatchers.anyString17import org.mockito.Mockito.verify18import org.springframework.web.multipart.MultipartFile19import java.time.LocalDate20import java.time.LocalDateTime21class GoogleDriveClientTest : Spec() {22 init {23 val mapperMock: ObjectMapper = getMock()24 val connectorMock: OAuthConnector = getMock()25 val fileHelperMock: FileHelper = getMock()26 val googleDriveClient = GoogleDriveClient(27 objectMapper = mapperMock,28 googleDriveConnector = connectorMock,29 fileHelper = fileHelperMock30 )31 "getFile" should {32 "retrieve the fileId asking for webContentLink, mimeType and name of the file" {33 val responseMock: HttpResponse = getMock()34 on(connectorMock.get(anyString())).thenReturn(responseMock.right())35 val date = LocalDateTime.now()36 on(responseMock.deserializeAs(any(TypeReference::class.java))).thenReturn(37 GoogleFileDTO(38 id = "123",39 name = "some name",40 mimeType = "application/pdf",41 webContentLink = null,42 modifiedTime = date43 )44 )45 val expected = GoogleFileDTO(46 id = "123",47 name = "some name",48 mimeType = "application/pdf",49 webContentLink = null,50 modifiedTime = date51 ).right()52 val actual = googleDriveClient.getFile("123")53 actual shouldBe expected54 verify(connectorMock).get(55 eq("https://www.googleapis.com/drive/v3/files/123?fields=id,webContentLink,name,mimeType,modifiedTime")56 )57 }58 }59 "createFile" should {60 "make a POST to the API with the file" {61 val date = LocalDateTime.now()62 val metadataBytes = ByteArray(60)63 val responseMock: HttpResponse = getMock()64 on(mapperMock.writeValueAsBytes(any(MetadataDTO::class.java))).thenReturn(metadataBytes)65 on(connectorMock.post(66 anyString(),67 anyVararg()68 )).thenReturn(responseMock.right())69 on(responseMock.deserializeAs(any(TypeReference::class.java))).thenReturn(70 FileCreatedDTO(71 id = "123",72 name = "some-file",73 mimeType = "application/pdf",74 createdTime = date75 )76 )77 val multipartMock: MultipartFile = getMock()78 val multipartBytes = ByteArray(70)79 on(multipartMock.bytes).thenReturn(multipartBytes)80 val expected = FileCreatedDTO(81 id = "123",...

Full Screen

Full Screen

UiControllerCacheTest.kt

Source:UiControllerCacheTest.kt Github

copy

Full Screen

...15import org.junit.Test16import org.mockito.Mockito.RETURNS_DEEP_STUBS17import org.mockito.Mockito.verifyNoInteractions18import org.mockito.kotlin.any19import org.mockito.kotlin.anyVararg20import org.mockito.kotlin.clearInvocations21import org.mockito.kotlin.doAnswer22import org.mockito.kotlin.doReturn23import org.mockito.kotlin.mock24import org.mockito.kotlin.stub25import org.mockito.kotlin.verify26import org.mockito.kotlin.verifyNoMoreInteractions27import org.mockito.kotlin.whenever28import timber.log.Timber29class UiControllerCacheTest {30 private lateinit var parent: ViewGroup31 private lateinit var parentController: BaseController<*>32 private lateinit var imageFactory: BaseController.Factory<BaseController<Image>>33 private lateinit var imageFactory2: BaseController.Factory<BaseController<Image>>34 private lateinit var variationResolver: VariationResolver35 private lateinit var cache: UiControllerCache36 @Before37 fun setup() {38 parent = mock(defaultAnswer = RETURNS_DEEP_STUBS)39 parentController = mock()40 imageFactory = mock { on { create(parent, parentController) } doAnswer { mock() } }41 imageFactory2 = mock { on { create(parent, parentController) } doAnswer { mock() } }42 variationResolver = mock { on { resolve(any()) } doReturn null }43 cache = UiControllerCache(44 parent,45 parentController,46 mapOf(47 UiControllerType.create(Image::class) to imageFactory,48 UiControllerType.create(Image::class, 2) to imageFactory249 ),50 setOf(variationResolver)51 )52 }53 // region acquire()54 @Test55 fun testAcquireReusesReleased() {56 val model = mock<Image>()57 val image = mock<BaseController<Image>>()58 cache.release(model, image)59 val image2 = cache.acquire(model)60 assertSame(image, image2)61 }62 @Test63 fun testAcquireDoesntReuseDifferentVariation() {64 val model1 = mock<Image>()65 val model2 = mock<Image>()66 variationResolver.stub {67 on { resolve(model1) } doReturn 168 on { resolve(model2) } doReturn 269 }70 val image = mock<BaseController<Image>>()71 cache.release(model1, image)72 assertThat(cache.acquire(model2), not(sameInstance(image)))73 assertThat(cache.acquire(model1), sameInstance(image))74 }75 // endregion acquire()76 // region createController()77 @Test78 fun testCreateController() {79 val model = mock<Image>()80 val controller = cache.acquire(model)81 assertNotNull(controller)82 verify(imageFactory).create(parent, parentController)83 verifyNoInteractions(imageFactory2)84 verifyNoMoreInteractions(imageFactory)85 clearInvocations(imageFactory)86 val controller2 = cache.acquire(model)87 assertNotNull(controller2)88 assertNotSame(controller, controller2)89 verify(imageFactory).create(parent, parentController)90 verifyNoInteractions(imageFactory2)91 verifyNoMoreInteractions(imageFactory)92 }93 @Test94 fun testCreateControllerVariations() {95 val model = mock<Image>()96 whenever(variationResolver.resolve(model)).thenReturn(2)97 val controller = cache.acquire(model)98 assertNotNull(controller)99 verify(imageFactory2).create(parent, parentController)100 verifyNoInteractions(imageFactory)101 verifyNoMoreInteractions(imageFactory2)102 }103 @Test(expected = IllegalArgumentException::class)104 fun testCreateControllerFactoryMissingDebug() {105 parent.context.applicationInfo.flags = ApplicationInfo.FLAG_DEBUGGABLE106 cache.acquire(mock<Text>())107 }108 @Test109 fun testCreateControllerFactoryMissingRelease() {110 val tree = mock<Timber.Tree>()111 Timber.plant(tree)112 try {113 val controller = cache.acquire(mock<Text>())114 assertNull(controller)115 verifyNoInteractions(imageFactory)116 verify(tree).e(any<IllegalArgumentException>(), any(), anyVararg())117 } finally {118 Timber.uproot(tree)119 }120 }121 // endregion createController()122}...

Full Screen

Full Screen

Matchers.kt

Source:Matchers.kt Github

copy

Full Screen

...42inline fun <reified T : Any> anyOrNull(): T {43 return ArgumentMatchers.any<T>() ?: createInstance()44}45/** Matches any vararg object, including nulls. */46inline fun <reified T : Any> anyVararg(): T {47 return ArgumentMatchers.any<T>() ?: createInstance()48}49/** Matches any array of type T. */50inline fun <reified T : Any?> anyArray(): Array<T> {51 return ArgumentMatchers.any(Array<T>::class.java) ?: arrayOf()52}53/**54 * Creates a custom argument matcher.55 * `null` values will never evaluate to `true`.56 *57 * @param predicate An extension function on [T] that returns `true` when a [T] matches the predicate.58 */59inline fun <reified T : Any> argThat(noinline predicate: T.() -> Boolean): T {60 return ArgumentMatchers.argThat { arg: T? -> arg?.predicate() ?: false } ?: createInstance(...

Full Screen

Full Screen

RelativeDateFormatterTest.kt

Source:RelativeDateFormatterTest.kt Github

copy

Full Screen

...16package com.maltaisn.notes.utils17import android.content.res.Resources18import com.maltaisn.notes.dateFor19import com.maltaisn.notes.sync.R20import com.nhaarman.mockitokotlin2.anyVararg21import com.nhaarman.mockitokotlin2.doAnswer22import com.nhaarman.mockitokotlin2.mock23import org.junit.Before24import org.junit.Test25import org.mockito.ArgumentMatchers.anyInt26import java.text.DateFormat27import java.util.Locale28import kotlin.test.assertEquals29class RelativeDateFormatterTest {30 private lateinit var formatter: RelativeDateFormatter31 @Before32 fun before() {33 Locale.setDefault(Locale.CANADA)34 val strings = mapOf(35 R.string.date_rel_today to "today, %s",36 R.string.date_rel_tomorrow to "tomorrow, %s",37 R.string.date_rel_yesterday to "yesterday, %s",38 R.string.date_rel_absolute to "%s, %s",39 R.plurals.date_rel_days_past to "%d days ago, %s",40 R.plurals.date_rel_days_future to "in %d days, %s",41 )42 val resources: Resources = mock {43 on { getString(anyInt(), anyVararg()) } doAnswer {44 strings[it.arguments[0]]?.format(*it.arguments.copyOfRange(1, it.arguments.size))45 }46 on { getQuantityString(anyInt(), anyInt(), anyVararg()) } doAnswer {47 strings[it.arguments[0]]?.format(*it.arguments.copyOfRange(2, it.arguments.size))48 }49 }50 formatter = RelativeDateFormatter(resources) { date ->51 DateFormat.getDateInstance(DateFormat.SHORT, Locale.CANADA).format(date)52 }53 }54 @Test55 fun `should return today date time`() {56 assertEquals("today, 12:34 p.m.", formatter.format(57 dateFor("2020-01-01T12:34:56.000").time,58 dateFor("2020-01-01T10:00:00.000").time,59 660 ))...

Full Screen

Full Screen

MockAndroidObjects.kt

Source:MockAndroidObjects.kt Github

copy

Full Screen

...4import android.content.res.Resources5import com.bottlerocketstudios.brarchitecture.R6import org.mockito.ArgumentMatchers7import org.mockito.kotlin.any8import org.mockito.kotlin.anyVararg9import org.mockito.kotlin.doAnswer10import org.mockito.kotlin.doReturn11import org.mockito.kotlin.eq12import org.mockito.kotlin.mock13val testResources: Resources = mock {14 // Order is important here, most generic match first. Last match is final value.15 on { getQuantityString(any(), any(), anyVararg()) } doReturn ""16 on { getDrawable(any()) } doReturn null17 on { getDrawable(any(), any()) } doReturn null18 on { getString(any(), anyVararg()) } doReturn ""19 // Add specific mocks for getString/getQuantity/etc string/plural/etc references and mocked values here20 on { getQuantityString(eq(R.plurals.days_ago_plural), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()) } doAnswer {21 if (it.getArgument<Int>(1) == 1) {22 "${it.getArgument<Int>(1)} day ago"23 } else {24 "${it.getArgument<Int>(2)} days ago"25 }26 }27 on { getQuantityString(eq(R.plurals.sample_plural_format), ArgumentMatchers.anyInt(), ArgumentMatchers.anyString(), ArgumentMatchers.anyInt()) } doAnswer {28 if (it.getArgument<Int>(1) == 1) {29 "${it.getArgument<Int>(2)} was updated ${it.getArgument<Int>(3)} day ago"30 } else {31 "${it.getArgument<Int>(2)} was updated ${it.getArgument<Int>(3)} days ago"32 }33 }34}35val testContext: Context = mock {36 // Order is important here, most generic match first. Last match is final value.37 on { getString(any()) } doReturn ""38 on { getDrawable(any()) } doReturn null39 on { getString(any(), anyVararg()) } doReturn ""40 on { resources } doReturn testResources41 // Add specific mocks for getString/getQuantity/etc string/plural/etc references and mocked values here42 on { getString(R.string.today) } doReturn "Today"43 on { getString(R.string.app_name) } doReturn "App Name"44 on { getString(eq(R.string.sample_format), ArgumentMatchers.anyString()) } doAnswer {45 "Sample ${it.getArgument<String>(1)}"46 }47}48fun testApplicationFactory(49 mockContext: Context = testContext50): Application = mock {51 on { applicationContext } doReturn mockContext52 on { resources } doReturn testResources53 // Order is important here, most generic match first. Last match is final value.54 on { getDrawable(any()) } doReturn null55 on { getString(any()) } doReturn ""56 on { getString(any(), anyVararg()) } doReturn ""57 // Add specific mocks for getString/getQuantity/etc string/plural/etc references and mocked values here58}...

Full Screen

Full Screen

MockitoMatchers.kt

Source:MockitoMatchers.kt Github

copy

Full Screen

...27 /**28 * Matches any vararg of type T.29 * Use with the spread operator <pre>'*'</pre>.30 */31 inline fun <reified T> anyVararg(): Array<out T> {32 return VarArgMatcher.varArgThat(object : BaseMatcher<Array<out T>>() {33 override fun describeTo(description: Description?) {34 description?.appendText("matches anything")35 }36 override fun matches(item: Any?): Boolean = true37 })38 }39 /**40 * Matcher for varargs.41 */42 class VarArgMatcher<T> @PublishedApi internal constructor(43 private val hamcrestMatcher: Matcher<Array<out T>>44 ) : ArgumentMatcher<Array<out T>>, VarargMatcher {45 companion object {...

Full Screen

Full Screen

anyVararg

Using AI Code Generation

copy

Full Screen

1val anyVararg = Matchers.anyVararg()2val anyOrNull = Matchers.anyOrNull()3val argThat = Matchers.argThat { true }4val check = Matchers.check { true }5val eq = Matchers.eq(1)6val isA = Matchers.isA(String::class.java)7val isNull = Matchers.isNull()8val isNotNull = Matchers.isNotNull()9val isNullType = Matchers.isNull<String>()10val isNotNullType = Matchers.isNotNull<String>()11val refEq = Matchers.refEq("")12val same = Matchers.same("")13val sameOrNull = Matchers.sameOrNull("")14val startsWith = Matchers.startsWith("")15val endsWith = Matchers.endsWith("")16val contains = Matchers.contains("")17val matches = Matchers.matches("")18val containsInAnyOrder = Matchers.containsInAnyOrder(listOf(""))19val containsInOrder = Matchers.containsInOrder(listOf(""))20val containsOnly = Matchers.containsOnly("")21val containsOnlyInAnyOrder = Matchers.containsOnlyInAnyOrder("")

Full Screen

Full Screen

anyVararg

Using AI Code Generation

copy

Full Screen

1 val anyVararg = anyVararg<String>()2 val anyOrNull = anyOrNull<String>()3 val anyOrNullVararg = anyOrNullVararg<String>()4 val eq = eq<String>("")5 val isA = isA<String>()6 val isNull = isNull<String>()7 val isNotNull = isNotNull<String>()8 val refEq = refEq<String>()9 val refEq2 = refEq<String>(null)10 val refEq3 = refEq<String>(null, null)11 val refEq4 = refEq<String>(null, null, null)12 val refEq5 = refEq<String>(null, null, null, null)13 val refEq6 = refEq<String>(null, null, null, null, null)14 val refEq7 = refEq<String>(null, null, null, null, null, null)15 val refEq8 = refEq<String>(null, null, null, null, null, null, null)16 val refEq9 = refEq<String>(null, null, null, null, null, null, null, null)17 val refEq10 = refEq<String>(null, null, null, null, null, null, null, null, null)

Full Screen

Full Screen

anyVararg

Using AI Code Generation

copy

Full Screen

1fun setUp() {2MockKAnnotations.init(this)3}4fun test() {5val list = listOf(1, 2, 3)6every { mockK.anyVararg(list) } returns true7}8}9at io.mockk.impl.eval.RecordedBlockEvaluator.record(RecordedBlockEvaluator.kt:23)10at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:30)11at io.mockk.impl.eval.EveryBlockEvaluator.every$default(EveryBlockEvaluator.kt:26)12at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:21)13at io.mockk.impl.eval.EveryBlockEvaluator.every$default(EveryBlockEvaluator.kt:15)14at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:7)15at io.mockk.impl.eval.EveryBlockEvaluator.every$default(EveryBlockEvaluator.kt:5)16at io.mockk.impl.eval.EveryBlockEvaluator.every(EveryBlockEvaluator.kt:1)17at io.mockk.impl.eval.EveryBlockEvaluator.every$default(EveryBlockEvaluator.kt:1)18at io.mockk.MockKDsl.internalCoEvery(API.kt:117)19at io.mockk.MockKDsl.internalCoEvery$default(API.kt:115)20at io.mockk.MockKDsl.coEvery(API.kt:110)21at io.mockk.MockKDsl.coEvery$default(API.kt:108)22at com.example.demo.MockKTest.test(MockKTest.kt:22)23at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)24at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)25at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)26at java.lang.reflect.Method.invoke(Method.java:498)27at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)28at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)29at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)30at org.junit.internal.runners.statements.InvokeMethod.evaluate(

Full Screen

Full Screen

anyVararg

Using AI Code Generation

copy

Full Screen

1val anyVararg = Matchers.anyVararg()2val anyVararg = anyVararg<Int>()3@Deprecated("Use anyVararg() instead of anyVararg<T>()", ReplaceWith("anyVararg()"))4fun <T> anyVararg(): T = org.mockito.kotlin.anyVararg()5val anyOrNull = Matchers.anyOrNull()6val anyOrNull = anyOrNull<Int>()7@Deprecated("Use anyOrNull() instead of anyOrNull<T>()", ReplaceWith("anyOrNull()"))8fun <T> anyOrNull(): T = org.mockito.kotlin.anyOrNull()9val anyOrNull = Matchers.anyOrNull()10val anyOrNull = anyOrNull<Int>()11@Deprecated("Use anyOrNull() instead of anyOrNull<T>()", ReplaceWith("anyOrNull()"))12fun <T> anyOrNull(): T = org.mockito.kotlin.anyOrNull()13val anyOrNull = Matchers.anyOrNull()14val anyOrNull = anyOrNull<Int>()15@Deprecated("Use anyOrNull() instead of anyOrNull<T>()", ReplaceWith("anyOrNull()"))16fun <T> anyOrNull(): T = org.mockito.kotlin.anyOrNull()17val argThat = Matchers.argThat { true }18val argThat = argThat<Int> { true }19@Deprecated("Use argThat() instead of argThat<T>()", ReplaceWith("argThat()"))20fun <T> argThat(matcher: (T) -> Boolean): T = org.mockito.kotlin.argThat(matcher)21val refEq = Matchers.refEq("value")22val refEq = refEq<String>("value")23@Deprecated("Use refEq() instead of refEq<T>()", ReplaceWith("refEq()"))24fun <T> refEq(value: T): T = org.mockito.kotlin.refEq(value)25val refEq = Matchers.refEq("value")26val refEq = refEq<String>("value")27@Deprecated("Use refEq() instead of refEq<T>()", ReplaceWith("refEq()"))28fun <T> refEq(value: T): T = org.mockito.kotlin.refEq(value)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Mockito-kotlin automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful