Java · Advanced level

Advanced level · Module 6: Java Capstone Project · Lesson 4 of 5

Testing and Quality

Complete the test suite, measure what is covered and fix the weaknesses it reveals.

In this lesson you will

  • Complete unit, controller and integration tests for the capstone
  • Use coverage and a review checklist to find gaps

Key concepts

test pyramidcoverage reportedge casescode review checklist

The lesson

Aim for many fast unit tests of rules, a set of controller tests for each endpoint's success and error cases, and a few full integration tests of the main flows. This balance gives confidence without a slow build.

A coverage report shows untested code. Look especially for untested branches in business rules, which are where bugs cost most.

Run a checklist review before submission: no secrets in code, no unused classes, consistent names, meaningful test names and a build that passes from a clean checkout.

Step by step

  1. List every rule and check it has tests.
  2. Generate a coverage report and examine untested branches.
  3. Add the missing tests.
  4. Do a clean checkout and run mvn clean verify.

Practice activity

Complete milestone 4: the full test suite with a short note on coverage and remaining risks.

Expected result: A passing build from a clean checkout and a coverage note naming any untested areas.

Check your understanding

  1. Which code most needs high test coverage?

    Show answer

    Business rules, where bugs are most costly.

  2. Why build from a clean checkout before submitting?

    Show answer

    To prove the project builds without files or settings that exist only on your machine.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.