Skip to content

Flamingo: Fix unit tests (MockitoException at TypeCache.java) #5339

Closed
@nicolas-raoul

Description

@nicolas-raoul

High-priority, so anyone feel free to send a pull request for this.
In other words, no need to ask to get assigned, everyone can start working on it immediately if they wish. :-)


This branch is compatible with Flamingo (the latest Android studio):
https://github.com/commons-app/apps-android-commons/tree/v4.2.0-release (based on Siva's branch )
And it runs well on devices.

Unfortunately, all unit tests fail with this stacktrace:

FAILED
    org.mockito.exceptions.base.MockitoException at TestCommonsApplication.kt:81
        Caused by: org.mockito.exceptions.base.MockitoException at TypeCache.java:152
            Caused by: java.lang.IllegalStateException at InlineBytecodeGenerator.java:177
                Caused by: java.lang.IllegalArgumentException at ClassReader.java:184

It happens since that branch switched to Flamingo and to a higher JDK level.
Updating jacoco.gradle's toolVersion to 0.8.10 alone does not fix the unit tests, but it is probably worth doing.
In app/build.gradle I see that we are using 2.* mockito packages, while the latest versions seem to be 5.*, time to update maybe?
Some other packages may need to be updated too.
There is a possibility that some code changes may be needed.

Your task:

  1. Pull from the branch above
  2. Make the unit tests work (it is fine if a few still fail)
  3. Send a pull request

To fix the unit tests, an idea could be to update version numbers of testing/mock-related packages. The latest stable version numbers can be seen on each project's website. Another idea could be searching for similar exceptions on Stack Overflow.

This is high priority because it prevents us from making our main branch Flamingo-friendly.
Looking forward to your pull requests. :-)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions