mock

A collection of 2 posts

A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
Oct 7, 2012 mock powermock testng unit testing

PowerMock, features and use-cases

Even if you don’t like it, your job sometimes requires you to maintain legacy applications. It happened to me (fortunately rarely), and the first thing I look for before writing as much as a single character in a legacy codebase is a unit testing harness. Most of the time, I tend to focus on the code coverage of the part of the application I need to change, and try to improve it as much as possible, even in the total lack of unit tests.

Nicolas Fränkel
Apr 22, 2009 isolation mock mockito mockrunner test

Two different mocking approaches

Whether you choose to choose to adopt TDD or a more traditional approach, you will test your classes in isolation. This usually mean you code with interfaces and inject your dependencies in your classes. Last year, I had to test a servlet. Servlets are the showcase to demonstrate out-of-container testing because of their dependencies to said container in their doXxx() method. Every one of these methods has a dependency on HttpServletRequest and HttpServletResponse. Both are interfaces that have

Nicolas Fränkel
A Java geek © 2008-2023
v. 15198510503f93d71075e225414877ccbee2e6e8/3962327697
Latest Posts