inflearn logo

If You’re Afraid to Make Changes to a Legacy Codebase with Zero Tests: Find 5 Hidden Bugs with Claude Code and Verify Them with Mutation Testing

We’ve learned how to use Claude Code, but how do we use it with our legacy system? We add a safety net to a Spring Boot order service with zero tests, catch five hidden bugs, and validate AI-written tests with mutation testing.

1 learners are taking this course

Level Basic

Course period Unlimited

TDD
TDD
Spring Boot
Spring Boot
JUnit
JUnit
Mockito
Mockito
Refactoring
Refactoring
TDD
TDD
Spring Boot
Spring Boot
JUnit
JUnit
Mockito
Mockito
Refactoring
Refactoring

What you will gain after the course

  • Use Claude Code to add characterization tests and golden masters that lock down the current behavior of an untested service class.

  • I write prompt rules to prevent AI from secretly fixing bugs or making up expected values.

  • Introduce seams around the current time, static methods, and SQL within services with minimal changes.

  • Choose unit, slice (JDBC/web), and integration tests according to your goals.

  • Validating AI-generated tests with JaCoCo coverage and PIT mutation scores

  • Fix bugs by writing failing policy tests first, then making the minimal changes needed.

  • We embed the process in the team through CLAUDE.md testing rules, a skill for adding tests, and CI gates.

From zero tests to 88, catching all five hidden bugs and reaching a 92% mutation score—these are the actual results measured in the course exercises.

I’ve learned how to use Claude Code, but how do I use it with our legacy code? Add a safety net to a Spring Boot order service with no tests using Claude Code, catch 5 hidden bugs, and validate AI-written tests with mutation testing.

This is not a course that teaches you how to write tests from scratch. Starting with existing legacy code that has zero tests, it uses real execution screens to show how to have AI read the code, write characterization tests, patch and refactor it—and what people need to verify. You’ll see firsthand how bugs can slip through even with high coverage, and use mutation scores to weed out “tests that merely pass.”

By the end of this course

  • Use Claude Code to add characterization tests and golden masters that lock in the current behavior of service classes with no tests.

  • Write prompt rules to prevent the AI from secretly fixing bugs or making up expected values.

  • Add seams around the current time, static methods, and SQL within services with minimal changes.

  • Choose unit, slice (JDBC/web), and integration tests based on their purpose.

  • Validate AI-generated tests using JaCoCo coverage and PIT mutation scores.

  • Policy tests first → fix the bug with minimal changes.

  • Document the process for the team through CLAUDE.md testing rules, a test-writing skill, and CI gates.

Recommended for people like these

  • A backend developer who has tried Claude Code but is unsure how to use it with their company’s codebase, which has no tests.

  • Spring developer who inherited a legacy system and is afraid of what might break every time they make a change.

  • A team lead who needs criteria for judging whether AI-generated tests can be trusted.

Curriculum (8 sections · 42 lessons · approximately 319 minutes)

  • Section 1. Your First Success — Complete Demo: Catching 5/5 Bugs with Zero Tests, Your First Bug in 5 Minutes: A 50,000-Won Order Gets Charged for Shipping, Start Again Even If You Get Stuck: Practice Environment and Checkpoint Tags, Clicked Through 82% by Hand but Still Can’t See the Bugs: Measuring the Baseline, When “Explain It” Gives the Wrong Answer: Designing Reading Questions

  • Section 2. Having AI read legacy code — The docs say one thing, the code says another: comparing policies, No one knows where the DB is used: mapping side effects, When everything seems important: ranking change-risk areas, When AI is confident about the wrong file: defining the reading scope, What you read disappears the next day: notes on characteristics

  • Section 3. Characterization Tests and Golden Master — Lock It Down Before Fixing: Characterization Tests, Find Suspicious Values at the Boundaries: Lock Them Down with a Boundary-Value Table, AI Silently Fixed the Bug: "Lockdown Only" Prompt, Too Many Combinations: Golden Master Recording, The Golden Master Changed: Approval and Reading Differences, Suspicious Behavior Accumulates: Bug Candidate Ledger

  • Section 4. Break Dependencies at Seam Points — There’s no room for tests to step in: seam points, It can’t be reproduced in November: inject a clock, Coupons get blocked on May 31: a second bug with a time seam, A static method stands in the way: wrap coupon calculation, SQL is embedded in the service: gather queries

  • Section 5. Extracting and choosing test types — Will behavior change if we extract the giant method?: extracting calculations, AI changed even the signature: reviewing the patch to seal the gap, tests are slow and brittle: a unit/slice/integration decision table, Is the point query correct?: JDBC slice, the error response quietly changes: web slice, orders work but cancellations are strange: a single integration test thread

  • Section 6. Validating AI-Generated Tests — High coverage, but bugs still slip through: reading JaCoCo, Do the tests really verify anything? Deliberately breaking the code, The mutant survived: tests that only pass, Too many to fix by hand: letting AI hunt mutants, What should you look for in a review? Five types of AI-generated tests to filter out

  • Section 7. Bug Fixes and Refactoring — Fixing a bug breaks a characterization test: the order of reversal, VIP members only earn 1%: a string comparison bug, earning more points after getting a discount: the rewards calculation basis, points increase after cancellation: missing point reversal, can a massive service be split up: before-and-after regression detection

  • Section 8. Team Conventions, CI, and Capstone — The next person makes the same mistake: CLAUDE.md testing rules; I type the same prompt every time: the add-tests skill; nobody runs it: the CI gate; capstone: a safety net for one of my legacy classes; bugs H2 and mocks can't catch — next steps

Lab Environment

Download the legacy-shop repository ZIP for the exercises (Spring Boot 3.5, Gradle Wrapper, embedded H2 database) and run it with JDK 21 or later. Each lesson has a Git checkpoint tag (cp-00~cp-41), so if you get stuck, you can start again from that point. The repository also includes prompt files for each lesson and the bin/ai, bin/t, and bin/score scripts. Docker is needed only for the MySQL comparison exercise in the final lesson.

Prerequisites

  • Have used Claude Code before.

  • Have used unit tests (JUnit) before

  • Have built and run a Spring Boot project before.

What This Course Does Not Cover

  • JUnit and Mockito Syntax Basics

  • Developing a New Feature from Scratch with TDD

  • Design philosophies such as hexagonal architecture and DDD

  • Advanced integration testing based on real MySQL and containers (topic for a follow-up course)

  • Claude Code Installation and Basic Usage

Note: The narration in this course was generated using synthetic AI voice, while the Claude Code output shown on screen is the actual output from a real run. AI responses may vary slightly each time you run them.

The narration for this course was created using an AI-generated voice, and the Claude Code results shown on screen are from an actual run. The AI’s responses may vary slightly each time they are generated. All data is fictional and for educational purposes; numbers may vary depending on the execution environment.

Recommended for
these people

Who is this course right for?

  • A backend developer who tried Claude Code but was stumped about how to use it with the company’s codebase, which has no tests.

  • A Spring developer who inherits legacy code and is afraid of what might break every time they fix something.

  • A team lead who needs criteria for deciding whether to trust AI-generated tests.

Need to know before starting?

  • I’ve used Claude Code before.

  • I have experience writing unit tests (JUnit).

  • Have built and run Spring Boot projects before.

Hello
This is dorian05202988

Career Verified

A data craftsman with over 20 years of experience in databases and IT. As a DBA and manager of a DB Platform team, I work with database platforms and specialize in MySQL, PostgreSQL, Oracle, MongoDB, SQL tuning, AWS, Terraform, and Python. Drawing on experience in the gaming, finance, and IT services industries, I explain database and cloud architecture. I have published 『Oracle Practical Tuning: Learning SQL Patterns』 and 『Oracle Pro*C Practical Project Guide』, and have presented on serverless architectures, database selection, and multi-database strategies at AWS Summit 2018 and 2019 and DataYa Nolja 2020. Recently, I have been working on slow-query analysis and tuning recommendations using Bedrock LLM, automated DB specification sizing, and query workflows through a DB metadata MCP server and Slack bot. I explain database automation for developers and AI applications for non-developers through hands-on exercises tailored to the audience and objectives of each course. Rather than applying AI suggestions as-is, I teach a decision-making framework that verifies result equivalence, execution plans, and observability conditions, and defers action when the supporting evidence is insufficient. Company operational data and credentials are not included in the course materials.

More

Curriculum

All

42 lectures ∙ (5hr 19min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

dorian05202988's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$49,280.00

30%

$55.00