question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cryptic verification failed message in the IDE

See original GitHub issue

MockK: 1.12.0 AssertJ Core: 3.20.2 JUnit Jupiter: 5.7.2 Kotlin: 1.6.10 Koin Test JUnit5: 3.1.5 Android Studio Chipmunk 2021.2.1 Patch 1

When I run one of my tests I get a very cryptic message in the Android Studio test result window:

ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZy5qdW5pdC5wbGF0Zm9ybS5lbmdpbmUuc3VwcG9ydC5oaWVyYXJjaGljYWwuTm9kZVRlc3RUYXNrLmxhbWJkYSRleGVjdXRlUmVjdXJzaXZlbHkkOCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE5vZGVUZXN0VGFzay5qYXZhOjEyNykgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZy5qdW5pdC5wbGF0Zm9ybS5lbmdpbmUuc3VwcG9ydC5oaWVyYXJjaGljYWwuVGhyb3dhYmxlQ29sbGVjdG9yLmV4ZWN1dGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFRocm93YWJsZUNvbGxlY3Rvci5qYXZhOjczKSAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZy5qdW5pdC5wbGF0Zm9ybS5lbmdpbmUuc3VwcG9ydC5oaWVyYXJjaGljYWwuTm9kZVRlc3RUYXNrLmV4ZWN1dGVSZWN1cnNpdmVseSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE5vZGVUZXN0VGFzay5qYXZhOjEyNikgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZy5qdW5pdC5wbGF0Zm9ybS5lbmdpbmUuc3VwcG9ydC5oaWVyYXJjaGljYWwuTm9kZVRlc3RUYXNrLmV4ZWN1dGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE5vZGVUZXN0VGFzay5qYXZhOjg0KSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYXZhLnV0aWwuQXJyYXlMaXN0LmZvckVhY2ggI

(…)

hbC53b3JrZXIuY2hpbGQuU3lzdGVtQXBwbGljYXRpb25DbGFzc0xvYWRlcldvcmtlci5jYWxsKFN5c3RlbUFwcGxpY2F0aW9uQ2xhc3NMb2FkZXJXb3JrZXIuamF2YToxMzMpCglhdCBvcmcuZ3JhZGxlLnByb2Nlc3MuaW50ZXJuYWwud29ya2VyLmNoaWxkLlN5c3RlbUFwcGxpY2F0aW9uQ2xhc3NMb2FkZXJXb3JrZXIuY2FsbChTeXN0ZW1BcHBsaWNhdGlvbkNsYXNzTG9hZGVyV29ya2VyLmphdmE6NzEpCglhdCB3b3JrZXIub3JnLmdyYWRsZS5wcm9jZXNzLmludGVybmFsLndvcmtlci5HcmFkbGVXb3JrZXJNYWluLnJ1bihHcmFkbGVXb3JrZXJNYWluLmphdmE6NjkpCglhdCB3b3JrZXIub3JnLmdyYWRsZS5wcm9jZXNzLmludGVybmFsLndvcmtlci5HcmFkbGVXb3JrZXJNYWluLm1haW4oR3JhZGxlV29ya2VyTWFpbi5qYXZhOjc0KQo=]]></stackTrace><ijLogEol/> <failureType>assertionFailed</failureType><ijLogEol/> </result><ijLogEol/> </test><ijLogEol/></event></ijLog>

TimeAutomationPresenterTest > Solar > enable save if sunset trigger after set new geolocation() FAILED java.lang.AssertionError at TimeAutomationPresenterTest.kt:654 1 test completed, 1 failed > Task :myapp:automation:testDevDebugUnitTest FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':myapp:automation:testDevDebugUnitTest'. > There were failing tests. See the report at: file:///Users/lukaszkalnik/projects/my-app-android/myapp/automation/build/reports/tests/testDevDebugUnitTest/index.html

The generated HTML test report at the above file:/// path, however, when viewed in a browser, is correct (shows the failing test and the exact failed verification):

java.lang.AssertionError: Verification failed: calls are not in verification order

Matchers: 
+TimeAutomationView(#1).enableSave(eq(false)))
TimeAutomationView(#1).setCurrentLocation(null()))
TimeAutomationView(#1).setCurrentLocation(eq(Holzmarkt 1)))
+CommonConnectorApi(#6).getTimeAutomation(eq(automationDetailId), any()))
+TimeAutomationView(#1).enableSave(eq(true)))
+TimeAutomationView(#1).showWeekdays(eq([AutomationDay(selected=true, title=automation_sunday, value=sun), AutomationDay(selected=false, title=automation_monday, value=mon)])))

Calls:
1) +TimeAutomationView(#1).enableSave(false)
2) TimeAutomationView(#1).setTime(0, 0, Europe/Berlin)
3) TimeAutomationView(#1).showScenes([AutomationScene(selected=true, title=Außenbeleuchtung einschalten, value=scene_1234), AutomationScene(selected=false, title=Warmes Licht, value=scene_7890)])
4) TimeAutomationView(#1).showTriggers([AutomationTrigger(selected=false, title=automation_trigger_time, value=TIME), AutomationTrigger(selected=true, title=automation_trigger_sunrise, value=SUNRISE), AutomationTrigger(selected=false, title=automation_trigger_sunset, value=SUNSET)])
5) +TimeAutomationView(#1).enableSave(false)
6) TimeAutomationView(#1).setTrigger(SUNRISE)
7) +TimeAutomationView(#1).showWeekdays([AutomationDay(selected=true, title=automation_sunday, value=sun), AutomationDay(selected=false, title=automation_monday, value=mon)])
8) TimeAutomationView(#1).enableTestAutomation(true)
9) TimeAutomationView(#1).showGeolocationDetails(null)
10) +CommonConnectorApi(#6).getTimeAutomation(automationDetailId, continuation {})
11) +TimeAutomationView(#1).enableSave(true)
12) TimeAutomationView(#1).setTime(0, 0, Europe/Berlin)
13) TimeAutomationView(#1).showScenes([AutomationScene(selected=true, title=Außenbeleuchtung einschalten, value=scene_1234), AutomationScene(selected=false, title=Warmes Licht, value=scene_7890)])
14) TimeAutomationView(#1).showTriggers([AutomationTrigger(selected=false, title=automation_trigger_time, value=TIME), AutomationTrigger(selected=true, title=automation_trigger_sunrise, value=SUNRISE), AutomationTrigger(selected=false, title=automation_trigger_sunset, value=SUNSET)])
15) +TimeAutomationView(#1).enableSave(true)
16) TimeAutomationView(#1).setTrigger(SUNRISE)
17) +TimeAutomationView(#1).showWeekdays([AutomationDay(selected=true, title=automation_sunday, value=sun), AutomationDay(selected=false, title=automation_monday, value=mon)])
18) TimeAutomationView(#1).enableTestAutomation(true)
19) +TimeAutomationView(#1).enableSave(true)
20) TimeAutomationView(#1).setCurrentLocation(Holzmarkt 1)

Stack traces:
1)                                                                                                  io.mockk.impl.InternalPlatform.captureStackTrace                                       (InternalPlatform.kt:124)                          
                                                                                                      io.mockk.impl.stub.MockKStub.handleInvocation                                        (MockKStub.kt:250)                                 
                                                                    io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation                                              (JvmMockFactoryHelper.kt:23)                       
                                                                                             io.mockk.proxy.jvm.advice.Interceptor.call                                                    (Interceptor.kt:21)                                
                                                                                              io.mockk.proxy.jvm.advice.BaseAdvice.handle                                                  (BaseAdvice.kt:42)                                 
                                                                            io.mockk.proxy.jvm.advice.jvm.JvmMockKProxyInterceptor.interceptNoSuper   

The failing test looks like this (dependencies of the presenter are mocked with MockK and injected using KoinMockProvider.

    @JvmField
    @RegisterExtension
    val koinTestExtension = KoinTestExtension.create {
        modules(koinMockModule)
    }

    @JvmField
    @RegisterExtension
    val koinMockProvider = MockProviderExtension.create { mockkClass(it) }

    private val view = mockk<TimeAutomationView>(relaxUnitFun = true)
    private lateinit var commonConnectorApi: CommonConnectorApi
    private lateinit var systemDetailsRepository: SystemDetailsRepository

    @BeforeEach
    fun initMocks() {
        commonConnectorApi = declareMock()
        systemDetailsRepository = declareMock {
            every { systemDetails } returns systemDetailsStateFlow
            every { refreshGeolocation() } just Runs
        }
    }
        

        @Test
        fun `enable save if sunset trigger after set new geolocation`() = testScope.runTestAndCancel {
            with(presenter.test()) {
                attachView(view)
                presenter.onGeolocationClicked()
                detachView()

                systemDetailsStateFlow.value = SystemDetailsState(
                    geolocation = DataState.DataLoaded(geolocation),
                    geolocationString = DataState.DataLoaded(address)
                )

                attachView(view)
            }

            coVerifyOrder {
                view.enableSave(false)
                view.setCurrentLocation(null)
                view.setCurrentLocation(address)
                commonConnectorApi.getTimeAutomation("automationDetailId")
                view.enableSave(true)
                view.showWeekdays(automationDays)
            }
        }

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
Raibazcommented, Jul 8, 2022

Really looks like an IDE issue rather than an issue with mockk, closing this.

2reactions
lukasz-kalnik-gcxcommented, Jun 29, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

how to solve "Verification Failed!… | Apple Developer Forums
Choose the device that is giving you that error and select "Remove from account". After you have removed the device you can go...
Read more >
Data verification error - Code Composer Studio forum - TI E2E
I am using the LM4F232H5QC with Code Composer Studio 5.1.0.09 and the XDS100v2. When I enter debug mode and the application is flashed...
Read more >
Grpc error when running Arduino IDE example
I've installed Arduino IDE 2.0.0-rc9. When I try to verify/compile an example I get the error message: grpc: error while marshaling: pr…
Read more >
Getting Maven "Could not transfer artifact from/to releases-ee ...
You get an error message during your Maven build that seems to suggest Maven is looking wrongly for a dependency in Mulesoft Enterprise...
Read more >
As a professional C++ programmer, what is the most cryptic ...
I believe my error is qualified to be put as an answer here. It didn't stop at being cryptic, it consisted of 3027...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found