Masterclass – Effective Testing in Java

We all know that testing is important, but most of us have had little education about the different approaches to testing and are left to teach ourselves. Unfortunately, it takes most people years to learn good habits and techniques, and the mistakes we make when learning are often costly, frustrating, and counter-productive. We end up with slow tests, tests that break for bad reasons, and tests that are impossible to reason about when they fail.  In other words: useless tests.


22  March 2018, Iasi

Training fee: €250/participant plus VAT, only 25 seats available

To book your seats, please contact us by email ([email protected]) or phone (+40 741 103 133).

About the training

Many people simply return to the well-known technique of our self-taught days: code it, play with it, move on. In this workshop we’ll concentrate on helping you create tests that are effective: test that run quickly, only fail for good reasons, give you clear information when they break, and are easy to understand when you have to read them (which should be rarely).

This is a hands-on workshop where we’ll actively work through the methods of testing using the Java programming language. If you complete the labs you will have a completely working application that is fully covered, and demonstrates most of the topics covered in the course.


Participants should already know the Java programming language. At least a year of experience is recommend. The course contains material that even senior develops should find useful. Each participant that wishes to participate in the lab should come with a laptop that has their favorite IDE and git already installed and working. Labs will be done as a git fork of a maven-based Java project that participants will push to in order to share work. IntelliJ will be used by the instructor, but any IDE that can run JUnit tests and load Maven projects is fine.

Course Outline

Lecture 1 – The Basics

  • Demonstration of an effective test suite
  • Criteria of a good test
  • Identifying good tests
  • Why test coverage statistics are nearly useless
  • Test “code smells”: spotting bad tests
  • A summary of helpful rules

Lab 1 – Covering the Basics

  • In this lab you’ll write some simple unit tests that meet the criteria taught in the lesson.
  • Solutions to Lab 1 – Forum for discussion challenges and solutions.

Lecture 2 – The Spectrum of Tests

  • Cost/benefit analysis of manual vs. automated testing
  • Testing in the presence of side-effects
  • Dealing with I/O, Databases, and other “external” systems
  • System Integration Testing

Lab 2 – Dealing with I/O

  • In this lab you’ll write tests that cover the I/O concerns of the lab project.
  • Solutions to Lab 2 – Forum for discussion challenges and solutions.

Lecture 3 – Controlling the Layers

  • Writing Testable Code: Techniques that improve your ability to reason
  • The role of mocking and injection
  • An overview of injection techniques
  • Pros and Cons
  • Mocking code smells
  • Design patterns that can help
  • Language-specific workarounds

Lab 3 – Layered Testing

  • In this lab you’ll see how injection and mocking can make otherwise untestable things easy to test.
  • Solutions to Lab 3 – Forum for discussion challenges and solutions.

Lecture 4 – Managing Complexity

  • Design and Agile practices
  • Separating real complexity from incidental complexity
  • Techniques that leverage testing to enable evolving design over time
  • Some Case Studies as Examples

Lab 4 – Complete the Project

  • In this lab participants will complete the lab project.
  • Final Solution – Forum for discussion about the completed project.

Lecture 5 – Verification, Refactoring, and Code Hygiene

  • Spot-checking the test suite
  • When/why do you refactor?
  • Evolving the specification
  • Continuous Integration

Final Lab – Spot checking and CI

  • Get your tests running in CirclCI
  • Have another participant spot-check review your tests

The trainer

Vijay is a functional programmer in Clojure/Scala with 15 years of experience with Java and JVM technologies that includes building large enterprise applications, leading, architecting Big Data and Machine Learning projects. Vijay enjoys coaching and mentoring and is a Lightbend certified Advanced Scala Trainer.

He currently works as a Dangineer leading the Data Engineering/Analytics/Science team at Werkspot, Amsterdam and is a co-host of Defn Podcast, focused on Clojure.


22  March 2018, Iasi

Training fee: €250/participant plus VAT, only 25 seats available

To book your seats, please contact us by email ([email protected]) or phone (+40 741 103 133).

Browse more masterclasses here.