Articles in category Mockito
Ever included Mockito in your project and lost the nice feedback from Hamcrest?
And only when running your unit tests from IntelliJ IDEA? Instead of a message describing what
you should fix, you see java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch
I have. More than once and been very frustrated. These are tools I like. Not getting good messages upsets me.
Read more →I had a need to stub a method the other day that had a var arg method. I failed in stubbing it using Mockito. It disturb me a lot. But after mulling on the problem a while, I searched and found a simple solution.
Mockito has a anyVararg() method that you should use when you try to stub a method that takes a var arg
as argument.