Skip to Content
Unit Testing Principles, Practices, and Patterns
book

Unit Testing Principles, Practices, and Patterns

by Vladimir Khorikov
January 2020
Intermediate to advanced
304 pages
9h 8m
English
Manning Publications
Content preview from Unit Testing Principles, Practices, and Patterns

Chapter 11. Unit testing anti-patterns

This chapter covers

  • Unit testing private methods
  • Exposing private state to enable unit testing
  • Leaking domain knowledge to tests
  • Mocking concrete classes

This chapter is an aggregation of lesser related topics (mostly anti-patterns) that didn’t fit in earlier in the book and are better served on their own. An anti-pattern is a common solution to a recurring problem that looks appropriate on the surface but leads to problems further down the road.

You will learn how to work with time in tests, how to identify and avoid such anti-patterns as unit testing of private methods, code pollution, mocking concrete classes, and more. Most of these topics follow from the first principles described in part 2. Still, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Unit Testing Principles, Practices, and Patterns

Unit Testing Principles, Practices, and Patterns

Vladimir Khorikov
Design Patterns: Elements of Reusable Object-Oriented Software

Design Patterns: Elements of Reusable Object-Oriented Software

Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

Publisher Resources

ISBN: 9781617296277Publisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link