Unit Testing Legacy Code in Java

Untested code can be difficult and risky to maintain. This course will teach you techniques to get existing code under test as you work on it, without risky rewrites or redesigns.
Course info
Level
Intermediate
Updated
May 21, 2018
Duration
2h 8m
Table of contents
Description
Course info
Level
Intermediate
Updated
May 21, 2018
Duration
2h 8m
Description

One of the biggest challenges developers encounter in their career is having to maintain an existing codebase with little or no tests and unclear, tangled code. In this course, Unit Testing Legacy Code in Java, you will learn techniques to get a legacy and untested Java application, a small but realistic Java application to provide services to a hospital emergency room, under test incrementally as you work on it. First, you will learn about different types of tests and test doubles that can be applied to create a safety net for the application gradually. Next, you will discover crucial dependency-breaking techniques that will allow you to create seams to provide test doubles without disrupting the code. Finally, you will explore ways to deal with hard to understand code, improving the clarity as you work, and techniques to leverage new, tested code from hard to understand code. When you are finished with this course, you will have the knowledge to efficiently handle untested systems you’ve become responsible for.

About the author
About the author

Jim Weaver is a software developer and mentor with a love for small teams, light-weight processes, and close interaction with customers.

More from the author
Jira: Getting Started
Beginner
2h 37m
Mar 20, 2019
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone! I'm Jim Weaver for Pluralsight. In the course of my career, I've met my fair share of ugly, hard-to-test code. Such code's tough to work with, and being responsible for a whole code base of untested code can be challenging and intimidating. In this course, Unit Testing Legacy Code with Java, we're going to face just such a challenge together. We'll be asked to maintain a Java application that provides services to a hospital's emergency room operations. This business critical code base isn't particularly well written. And there isn't an automated test of any kind in sight. But our customer has pressing changes that need to be made. During this course, we'll learn a variety of techniques to tackle the biggest part of the legacy code problem, breaking dependencies between units of code that make testing difficult. The techniques we'll learn will allow us to get code under test with small, targeted conservative changes that don't disrupt other parts of the system. We won't be telling our customer to wait while we rewrite parts from scratch. We'll also learn techniques to improve the clarity of hard-to-understand code with low-risk changes until we can get a test in place, and we'll see how higher level tests can help improve our safety net as we gradually get code unit testable. By the end of this course, you'll have learned a toolkit's worth of techniques that will help you tackle untested legacy code bases. So come join me for unit testing legacy code in Java.