Tags » Mockito

Mocking static Logger without PowerMock

Suppose you have a class that uses a static Logger to log some error, and you would like to unit test including the message logged. One approach is to use PowerMock because the Logger is usually declared static in your class. 116 more words


How to solve: mocking chained calls

I have met this issue several times, so I decided to give the simplest solution to you. You have probably had a situation, when you need to return one object, but it demanded mocking each and every object in the middle. 88 more words


About testing things

Today I would like to talk about testing our code and what I’ve recently learned about it.

1. Layering the code

First of all, I need to raise the issue of usefulness or even necessity to split the code into layers. 569 more words


Testing Void Method Using Mockito

Mockito is industry wide mocking framework for unit test. It gives an ability to a developer to write his/her code without depending on other developer’s code. 299 more words


Unit Testing Basics

Episode 62

Previous episode was about talking to database in Spring. Today we will continue exploring basics of building web applications, and talk about unit testing. 1,387 more words


How to use mocks

At this weekend I decided to refactor some parts of the circuit simulator, because its source slowly becomes confusing. In detail I began to extract the graph package of the simulator into a new module which can also be used in other projects relying on a graph library. 1,122 more words


Mockito Essentials

A practical guide to get you up and running with unit testing using Mockito
About This Book

Explore Mockito features and learn stubbing, mocking and spying dependencies using the… 54 more words