Questions tagged [mockito-kotlin]

a library for Kotlin that provides helper functions to work with Mockito, a popular mock framework.

A library that provides helper functions to work with Mockito in Kotlin. Mockito is a popular mock framework.

66 questions
0
votes
1 answer

Mockito - Set default return string value for all mocked methods

I have a class that has over 20 methods that return string values. These strings are not relevant for my test, but it's pretty time consuming to set a when->thenReturn case for each of the functions, specially because there are several of these…
htafoya
  • 18,261
  • 11
  • 80
  • 104
0
votes
0 answers

Mockito MissingMethodInvocationException when using mock-maker-inline configuration

I am using Mockito to run tests in an android module. My tests works fine before adding the configuration for mock-maker-inline in src/test/resources/mockito-extensions file. But after adding this configuration some of my tests are not working any…
Alireza Ahmadi
  • 5,122
  • 7
  • 40
  • 67
0
votes
1 answer

Mockito unit tests - missplaced or missused argument matcher

I have an application with MVP architecture which includes these two methods : In Presenter class : override fun callSetRecyclerAdapter() { view.setRecyclerAdapter() view.setRefreshingFalse() } And in Model class override fun…
0
votes
2 answers

Kotlin: Unit Test getView method of ArrayAdapter

I have the following simple ArrayAdapter that I'd like to run UnitTests on: class AccountSpinnerAdapter(context: Context, textViewResourceId: Int, private val values: Set) : ArrayAdapter(context, textViewResourceId,…
muetzenflo
  • 5,653
  • 4
  • 41
  • 82
0
votes
0 answers

Kotlin Mockito Tests Failing for Exception Handling

I'm trying to write exception handling and tests for said handling in Kotlin, using Mockito. The tests are failing due to the exceptions not being thrown and I can't figure out why. It looks like they should be thrown and I'm stumped. Here is a…
Kendra
  • 125
  • 2
  • 12
-1
votes
1 answer

How to write Unit Test against Firebase Messaging Android

I am new to Unit test and Mockito. I am trying to write unit test for the below firebase call. Can anyone help me that how to write unit test for FirebaseMessaging using Mockito. Thanks fun unsubscribeEventVoucherTopic(String topic) { …
1 2 3 4
5