Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock expect class #79

Open
SergioR72 opened this issue Jan 4, 2024 · 1 comment
Open

Mock expect class #79

SergioR72 opened this issue Jan 4, 2024 · 1 comment
Labels
question Further information is requested

Comments

@SergioR72
Copy link

SergioR72 commented Jan 4, 2024

I have this code

 @Mock
    private val manager = mock(Manager::class)

    @Mock
    private val repository = mock(repository::class)


    private lateinit var viewModel: viewModel

    @BeforeTest
    override fun setUp() {
        super.setUp()
        loginViewModel = LoginViewModel(
            manager,
            repository
        )
    }

manager is an expect class, repository is a class in common also the viewModel.
repository and manager are injected by koin.
When I tried to mock manager I got this error

A mock for the type BiometricsManager was not generated.

    Make sure the property holding the mock is annotated with @Mock:

        @Mock
        private val myMock = mock(classOf<BiometricsManager>())
    

io.mockative.NoSuchMockException: A mock for the type BiometricsManager was not generated.

    Make sure the property holding the mock is annotated with @Mock:

        @Mock
        private val myMock = mock(classOf<BiometricsManager>())

there is a way how can I mock this expect class?

@Nillerr
Copy link
Collaborator

Nillerr commented Apr 13, 2024

Hi @SergioR72

Apologies for my hiatus from the project.

Can you provide an example of the expect / actual classes you're trying to test, and which source sets (e.g. commonMain, iosMain) they reside in respectively?

@Nillerr Nillerr added the question Further information is requested label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants