Instructor-led training
Express JUnit Training in Lawrenceburg, Tennessee
JUnit is the defacto standard framework for unit testing Java applications.
What you'll learn
Private Training for Teams
This course is offered as private, instructor-led training for organizations, onsite in Lawrenceburg, Tennessee or live online. Dates, delivery format, and course content are arranged around your team's requirements.
This course is not currently scheduled as a public class for individual enrollment.
Request Group TrainingPrerequisites
Course Outline
JUnit Intro
- Origins and foundation
- Rules of unit testing
- Obtaining, setup, configure JUnit
- Unit test execution
JUnit API
- Test case/class
- Test methods
- Assert methods
- Test suite
- Test runner
Additional API and Best Practices
- Additional JUnit annotations
- Exception testing
- Test Timeouts
- Hamcrest Matchers
- What to test
- Unit test naming
- Test organization
Software Testing
- Why unit testing
- Types of tests
- Types of unit tests
- Black vs. white box testing
- Code coverage
- Testable code
- Test-driven development
Stubs and Mock Objects
- Simulating missing objects
- Stubs
- Mock Objects and Mock Frameworks
- EasyMock
- JMock
- Stub vs. Mock
JUnit Extensions
- xUnit
- Unit testing and non-Java
- JUnit extensions and tools
Appendicies
- DbUnit - to unit test the persistence layer
- JWebUnit - to unit test Java Web applications
What makes unit testing with JUnit hard to master
The JUnit API is small: test classes, test methods, assert methods, test suites and test runners. The harder skill is deciding what to test and how to write code that can be tested. The syllabus moves from the framework to those design questions.
- Mechanics first. Setup and configuration, test execution, then the core API, followed by additional annotations, exception testing, test timeouts and Hamcrest matchers. Because JUnit relies heavily on annotations, shaky annotation knowledge slows everything after this point.
- Judgment next. What to test, unit test naming and test organization are covered with the API. They decide whether a suite stays useful or turns into maintenance cost.
- Testing theory. Types of tests and unit tests, black-box versus white-box testing, code coverage, testable code and test-driven development explain why the practices exist.
- Isolation. Stubs, mock objects and mock frameworks (EasyMock and JMock) are where most developers struggle. The stub-versus-mock comparison is the key point.
Common misconceptions: high coverage means good tests (coverage shows what ran, not what was verified); code that is hard to test is a testing problem (it is usually a design problem); and mocks should replace every collaborator (heavy mocking couples tests to implementation).
Who this one-day course suits and what to take around it
The course suits Java developers who write code without automated tests, or whose tests are informal, and want a structured grounding in unit testing. The prerequisite is basic Java plus comfort with annotations. It is also useful for team leads who want to agree on shared conventions for naming, organization and coverage expectations.
Because it is a one-day express format, it surveys the topics rather than going deep on any single one. If your Java fundamentals need work first, start with the Java Programming courses and learning guide. Once tests exist, the Continuous Integration with Jenkins course is a natural next step, because unit tests deliver most of their value when they run automatically on every build.
Illustrative scenarios
The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.
- Adding tests to a legacy service. A team might need to change business logic that has no tests. Applying the syllabus's testable-code and what-to-test topics, they could write assert-based test methods around the behavior first, then refactor with the suite as a safety net.
- Isolating a component from its dependencies. A developer might need to test a class that calls a remote service that is not yet available. Stubs or mock objects (EasyMock or JMock) can simulate that collaborator, so the test checks only the class's own logic.
- Testing the persistence layer. A team might want repeatable tests for database access code. The DbUnit appendix addresses unit testing the persistence layer, and JWebUnit addresses Java web applications.
AI coding assistants and unit testing
AI coding assistants are good at scaffolding: a test class skeleton, repetitive assert methods, or a first set of cases from a method signature. That saves time on boilerplate.
They tend to fail in ways that match this course's topics:
- Tests that assert nothing useful. Generated tests may only restate the implementation or pass trivially. Judge them against the course's what-to-test guidance and review the assert methods one by one.
- Over-mocking. Assistants often mock everything. Check whether a stub or a real object would do, using the stub-versus-mock distinction.
- API and version mismatch. Annotations, matcher imports and exception-testing styles differ across JUnit generations and mock frameworks. Confirm that generated code compiles and behaves correctly with the versions your project actually uses.
- Missing edge cases. Exceptions, timeouts and boundary conditions are often skipped.
To verify, run the tests, then deliberately break the code under test and confirm a test fails. Use code coverage to find unexecuted paths, not as proof of quality.
Frequently asked questions
What level is Express JUnit?
It is a general-level, one-day course for Java developers. It covers the JUnit API, best practices, testing concepts, stubs and mocks, and extensions.
What do I need to know beforehand?
A basic understanding of Java is required. Because JUnit makes extensive use of annotations, you should also be comfortable reading and applying Java annotations.
Does it cover test-driven development and mocking?
Yes. The syllabus includes test-driven development, code coverage, black-box versus white-box testing, stubs, mock objects, EasyMock, JMock and the stub-versus-mock distinction. It also has appendices on DbUnit and JWebUnit.
Can the course be delivered privately for our team, onsite or online?
Yes. HSG delivers private training for organizations either onsite at your location or live online.
Can the content be customized to the Java and JUnit versions we use?
Private training can be tailored to the technology versions an organization uses, including current releases, and content can be customized to your team's needs. You can request a training proposal to discuss it.Training locations
Express JUnit training across the U.S. and beyond.
We provide private Express JUnit training for organizations, onsite at your location or live online, throughout the United States and internationally.
View all Express JUnit training locations
Train your team with HSG
Private, instructor-led training customized for your organization.
- Onsite or live online delivery
- Customized curriculum
- For a single employee or an entire team
- Flexible scheduling
- Experienced instructors
Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com
Ready to train your team?
Let's customize this training for your organization.
Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.