Skip to content

A bunch of Java modules with me trying to solve exercises from the Tomek Kaczanowski's book - Practical Unit Testing with JUnit and Mockito

Notifications You must be signed in to change notification settings

IceMajor2/practical-unit-testing

Repository files navigation

Practical Unit Testing (Tomek Kaczanowski)

Book cover

This repository contains my solutions to the Tomasz Kaczanowski book's - Practical Unit Testing: with JUnit and Mockito (2nd edition) - exercises.

The book focuses - as the title states - on testing. Although it touches on more universal topics like TDD, mocks, parameterization, or overall good practices (naming, custom matchers, utility methods, etc.), it specializes in Java's testing frameworks (here: JUnit & Mockito), thus readers seeking in improving their Java skills will benefit even more.

Chapters

  • Chapter 3: Unit Tests with no Collaborators
    • Exercise 3.11.1: JUnit Run
    • Exercise 3.11.2: Learn About AssertJ
    • Exercise 3.11.3: String Reverse
    • Exercise 3.11.4: HashMap
    • Exercise 3.11.5: Fahrenheits to Celcius with Parameterized Tests
    • Exercise 3.11.6: Master Your IDE
  • Chapter 4: Test Driven Development
    • Exercise 4.11.1: Password Validator
    • Exercise 4.11.2: Regex
    • Exercise 4.11.3: Booking System
  • Chapter 5: Mocks, Stubs, and Dummies
    • Exercise 5.7.1: User Service Tested
    • Exercise 5.7.2: Race Results Enhanced
    • Exercise 5.7.3: Booking System Revisited
    • Exercise 5.7.4: Read, Read, Read!
  • Chapter 7: Things You Should Know
    • Exercise 7.13.1: Design Test Cases: State Testing
    • Exercise 7.13.2: Design Test Cases: Interactions Testing
    • Exercise 7.13.3: Test Collections
    • Exercise 7.13.4: Time Testing
    • Exercise 7.13.5: Redesign of the TimeProvider class
    • Exercise 7.13.6: Write a Custom Matcher
  • Chapter 8: Points of Controversy
    • Exercise 8.11.1: Property Based Testing
    • Exercise 8.11.2: Testing Legacy Code
  • Chapter 10: Organization Of Tests
    • Exercise 10.8.1: Test Fixture Setting
    • Exercise 10.8.2: Test Data Builder
  • Chapter 11: Maintainable Tests
    • Exercise 11.7.1: A Car is a Sports Car if ...
    • Exercise 11.7.2: Stack Test
  • Chapter 12: Test Quality
    • Exercise 12.8.1: Clean this Mess

Opinion

Undoubtedly recommended. Before taking up the book, I've had the basics of Java unit testing covered. However, it very quickly turned out that there is plenty more to learn. The book started very well and introduced challenging concepts gradually. It was a pleasant read, the author's writing was simple and succinct with some jokes here and there that I've found rather amusing than - which is more common in programming books - annoying.

About

A bunch of Java modules with me trying to solve exercises from the Tomek Kaczanowski's book - Practical Unit Testing with JUnit and Mockito

Topics

Resources

Stars

Watchers

Forks

Languages