Tags » Mockito

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

Powermockito behaving differently on debug

Another issue that took me a long time to figure out. I had a failing test, so I started to investigate the issue with the debugger. 209 more words

Java

When to use Mockito Spy?

If we only need to mock several methods of a class leaving the rest free to respond to calls normally, we cannot mock it, we have to spy it. 318 more words

Mockito