-
Notifications
You must be signed in to change notification settings - Fork 15
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
Mockito extension is ignored when running with Spek #36
Comments
In your kotlin unit test please remove |
Removed Added |
That's weird, I'll have to test with an android project. It's working with a non-android one. I'll get back to you if I have leads. |
My environment is Android Studio 2.3.1 macOS Sierra 10.12.4 |
Anything I can help you with? |
@vokilam Sorry, I haven't really have started the investigation - I'm a bit busy with work stuff right now. |
@vokilam i'm setting up my android environment, by any chance is the test passing when running from the command line? |
Cannot check until tomorrow, sorry. Which task should I run?
…On Sun, May 21, 2017, 15:32 Ranie Jade Ramiso ***@***.***> wrote:
@vokilam <https://github.com/vokilam> i'm setting up my android
environment, by any chance is the test passing when running from the
command line?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#36 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AApvSRs9_W7imk1bVaixJMY8LCyma9Gwks5r8C71gaJpZM4NTMun>
.
|
I'm not sure - not an android guy, probably the task that runs the unit tests :) |
Let me check, I will get back |
|
So most likely the problem is within the IDE. While using |
I'm a bit confused with results I get. I will check in IDEA also and get back :) |
Okay, here are my results. Set up IDEA
I created a file
Results
Set up Android Studio Results
Set up Android Studio JUnit 5
Summing up: Mockito extension is not applied when test is run from Android Studio via Spek plugin (junit4 and junit5). Same setup for IDEA (junit5) works fine. |
Hi, sorry for the very long delay. I still cant replicate it, can you try moving |
Hi, I'm facing the same issue... |
Hi.
There is an incubating feature of mockito framework that allows to mock previously unmockable entities like final classes.
Here is a sample project that demonstrates the issue: https://github.com/vokilam/test-spec-mockito/tree/master/app/src/test/java/com/vokilam/test_spec_mockito.
The problem is that this feature is ignored when running with Spek plugin (see
ExampleUnitTestKotlinSpek.kt
). Both java junit test (ExampleUnitTest.java
) and kotlin junit test (ExampleUnitTestKotlin.kt
) works as expected (final class is mocked).In case of Spek
test/resources/mockito-extensions/org.mockito.plugins.MockMaker
file is ignored and I got the following output:I'm not 100% sure this problem is connected with Spek plugin, however I wanted to identify a problem and to direct it to a corresponding tracker.
The text was updated successfully, but these errors were encountered: