Mocks have become part of the culture in all professional teams today. Used wisely, they allow fine-grained testing of functionality to reach a high-level and high-quality test coverage, granting you comfort to refactor and evolve your code. Used carelessly, mocking can lead to fragile tests, cause terrible headaches to dev team and end up slowing you down and impeding refactoring. 


This video course is for developers that have used mocks for a while in real-world projects, but despite being comfortable with the mocking API, are still looking for ways to use them effectively on the long run. 


This is the recording of a 3.5 hours live webinar that took place in October 2021.

Note: After watching the recording you can ask me any question you have via email.


Agenda

  • The Good parts: decoupling, isolation, speed
  • The Bad parts: fragile tests, inconsistencies, and impossible test cases
  • Mock Roles, not Objects priciple
  • The Command-Query Separation Principle
  • Functional Core / Imperative Shell segregation
  • Alternatives to Argument Captors
  • Mocking time - 4 techniques
  • Why and How to avoid Partial Mocks
  • Mocking vs External Libraries/APIs
  • Is mocking statics bad? Exceptions
  • When should we prefer a Fake implementation over a Mock


What to expect?

More than 2/3 of the time we code, refactoring and discussing tradeoffs of different usage patterns of mocks, stubs and fakes. When the discussions raises to the higher-level design, they are summarized in slides that you can later use as reference.

The coding happens in Java, but the discussion can also be followed by natives of other languages, like PHP, JS, C#,...

After following this workshop you’ll acquire solid knowledge about the best practices of using mocks, and learn how to write tests that are easy to maintain. Alongside you'll discover how to listen to what your unit tests are trying to tell you, and this way foster one of the most important sources of feedback about the design of your production code.


After the purchase you will get: the video recording, all the slides, and the code zipped together with Git commit history.


This Training is for you because:

  • You wrote or fixed hundreds of tests using mocks and you felt that those tests were too fragile, and not very helpful.
  • You want to lay the correct foundation for unit testing a new project you are about to start.
  • You want to listen to your tests to improve the design of your production code.


Prerequisites:

  • Strong knowledge of the core features offered by mocking frameworks (eg. Mockito)
  • Wrote at least 100 tests using mocks.
  • Enthusiast about software design.


Prep-work:

  • To strenghten your knowledge of the mocking features, you can watch the following introductory video: https://www.youtube.com/watch?v=A4Oq9oSpqD0
  • If your skills are a bit rusty, try to solve in advance the Prep-Assignent in the resources below (mocking-prepwork.zip).
  • As a follow-up, there's another 'Assignment' to tackle after watching the video.


Technical Requirements

I would recommend you get yourself a black coffee and pay close attention to the discussion, stop the recording at any moment, debate the ideas with your colleagues and perhaps try to reproduce my coding on your own machine. In the resources section, you can find the code zipped together with the git history, so you can explore my commits if you get lost. If still can't make it work, please don't hesitate to email me!

To run the project you will need a Java 8+ SDK installed, a decent IDE, and access to GitHub and Maven Central.

Trainer: Victor Rentea

Victor Rentea is a Java Champion, Associate Professor and Technical Trainer writing code for over two decades in many languages.

He is training developers since 2012, having developed an extensive curriculum that covers most of the software engineering best practices and typical Java-stack development. By now he trained over 2000 developers in 40+ companies, and you can read dozens of their recommendations on LinkedInFacebook, and on victorrentea.ro.

Victor is best known for the energy of his talks, many ranked among the best 3 at their conference. You can expect a similar style for any training he gives while explaining complex concepts in simple, easy to remember terms. If you want to keep close, you can join the Software Craftsmanship Community he founded in Romania or follow him on LinkedIN, Twitter, or Facebook.

Get Access

Frequently Asked Questions


Can I get an invoice for my company (VAT-free)?

To add the VAT code of your company to the checkout page and remove the VAT taxes, follow these simple steps.


Can I ask questions after I watch the recording?

PLEASE DO! Email me your questions, no matter how silly or complex you may think they are. I'd be glad to help, so don't hesitate to contact me.


How long do I have access to the course?

How does lifetime access sound? After enrolling, you have unlimited access to this course for as long as you like - across any and all devices you own.


What if I am unhappy with the course?

We would never want you to be unhappy! If you are unsatisfied with your purchase, contact us in the first 30 days and we will give you a full refund.


Can I have this training for more of my colleagues?

There are two ways I can help you:

  • For 5+ developers, contact me for a discount and a company invoice
  • For 10+ developers or for a longer in-depth session, contact me for a dedicated webinar for your company.