Tags » Mockito

anyString() v/s anyString() in Mocking frameworks

So I was trying out mocking frameworks for the first time a few days ago, and there’s an interesting observation: even though EasyMock, PowerMock… 361 more words

Technology

Stubbing a var arg method using Mockito

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. 259 more words

Programming

Scala in Business | Knoldus Newsletter - April 2015

Hello Folks

We are back again with AprilĀ 2015, Newsletter. Here is this Scala in Business | Knoldus Newsletter – April 2015

In this newsletter, you will get the business related news for… 49 more words

Scala

The Power of thenAnswer

Syntax:

when(myMock.method(myObject)).thenAnswer(Answer<?> answer);

or

doAnswer(Answer<?> answer).when(myMock).method(myObject);

Use case 1:

You can mock/stub void methods (as i explain in this post) to simulate the behaviour of them, which then will i.e. 728 more words

Mockito

Mockito Deep Stubs Example

This tutorial tries to explain how to use Mockito’s Deep Stubs feature.

When you’ve situations where your class under test has multiple levels of dependencies, … 322 more words

Java

How to mock void methods?

Void methods on mocks do nothing by default. But if we have to spy our objects in order to mock just a part of it, we may also have to mock the void methods. 303 more words

Mockito

Mockito & DBUnit: Implementing a mocking structure focused and independent to your automated tests on Java

Hi, my dear readers! Welcome to my blog. On this post, we will make a hands-on about Mockito and DBUnit, two libraries from Java’s open source ecosystem which can help us in improving our JUnit tests on focus and independence. 4,086 more words

Java