Java Testing with JUnit 5

JAV-312 (2 Days)

Request Pricing

JUnit 5 Training Overview

JUnit 5 is substantively different than JUnit 4. Although the core testing principles are the same, there are substantial implementation differences, important new features, and a brand new extension model.

Accelebrate's Java Testing with JUnit 5 teaches experienced Java developers the fundamentals of unit testing using JUnit 5 and Mockito libraries. Attendees learn how to test enterprise components in the persistence, service, and web layers. Best practices are emphasized and demonstrated throughout this course.

Location and Pricing

Most Accelebrate courses are taught as private, customized training for 3 or more attendees at our clients' sites worldwide. In addition, we offer live, private online classes for teams who may be in multiple locations or wish to save on travel costs. Please visit our client list for organizations for whom we have delivered onsite training. To receive a customized proposal and price quote for private on-site or online training, please contact us.

In addition, some courses are available as live, online classes for individuals. See a schedule of online courses.

JUnit 5 Training Objectives

All students will:

  • Understand the new JUnit 5 library structure, role of each component, and how they interact
  • Configure IDE projects to run tests natively, and via Maven Surefire
  • Write cohesive and effective tests and design classes for testability
  • Understand the full test lifecycle, and employ it to configure test fixtures
  • Run tests using all available mechanisms: IDE, Maven, JUnit Console Launcher, Launcher API
  • Use test discovery and filtering to define and run test plans, including conditional test execution
  • Employ naming conventions at every level - test name, classname, display name
  • Organize tests with assertion groups and nested tests
  • Use test interfaces to apply good OO principles to testing
  • Understand the new JUnit extension model, and how to write and use them
  • Understand JUnit 4 compatibility and migration
  • Use mock objects with Mockito to support isolated testing
  • Explore Mockito's facilities for dependency injection of mocks
  • Use argument matchers for more generalized testing with mocks
  • Implement partial mocking with spies
  • Understand the issues in testing enterprise components
  • Understand the two basic approaches: standalone testing with mocks, and in-container testing
  • Test database access components, using both fakes and an embedded database
  • Understand the additional issues involved in testing

JUnit 5 Training Outline

Expand All | Collapse All | Printer-Friendly

Introduction
Unit Testing with JUnit 5
  • Overview
    • Unit Testing and JUnit Overview
    • New Features in JUnit 5
    • JUnit 5 Library Components
    • Naming Conventions and Organizing Tests
  • Tests and Assertions
    • Writing Test Methods
    • Assertions
    • Assertion Messages
  • Test Fixtures and Test Lifecycle
    • Creating and Using Text Fixtures
    • Test Run Lifecycle: @BeforeEach and @AfterEach, @BeforeAll and @AfterAll
    • Controlling Test Instances
Writing and Running Tests (includes a brief primer on Java 8 new features)
  • Additional Testing Needs
    • Testing for Exceptions
    • Setting Timeouts
    • Assertion Groups
  • Running Test
    • IDE Support: Eclipse, IntelliJ IDEA
    • Maven Configuration
    • JUnit Platform Console Launcher
    • Launcher API
    • Test Discovery and Selection
    • Display Names
    • Grouping and Filtering with Tags
    • Configuration Parameters
    • Nested Tests
  • Advanced Capabilities
    • Custom Composed Annotations
    • Inheritance with Test Classes
    • Extensions
    • Conditional Test Execution
    • Parameterized Tests
  • JUnit 4 Migration
    • The Do-Nothing Case
    • Using a JUnit 4 Runner
    • API Changes
    • JUnit 4 Runners and Rules
    • JUnit 4 Test Suites
  • Best Practices
    • Testing Void and Private Methods
    • Test Cohesion and Assertion Scope
    • Characteristics of Good Tests
    • Writing Testable Code
    • Testing Anti-Patterns
Testing with Mocks
  • Overview
    • Mock Objects as Collaborators
    • Mockito Overview
  • Creating and Using Mocks
    • Basic Steps in Mocking
    • The Mockito Class
    • Mock Creation with @Mock
    • JUnit 5 MockitoExtension
    • Stubbing
  • Additional Capabilities
    • Argument Matchers
    • Partial Mocking with Spies
    • Mocking the Unmockable
    • Dependency Injection of Mocks
Testing Enterprise Components
  • Overview
    • Unit Testing vs. Integration Testing
    • Testing with Mocks vs. In-Container Testing
    • Mocks vs. Fakes
  • Testing the Persistence Layer
    • Database Options: Installed, Embedded, Embedded-in-Memory
    • Standalone vs. In-Container Testing
    • Test Independence and Transaction Rollback
    • In-Container Testing with Arquillian [Overview]
  • Testing Services
    • Similar Issues, Different Layer
    • Working with External Resources
    • The Argument for In-Container Testing
  • Testing Web Components
    • Interfacing with External Clients
    • Difficulties in Standalone Testing with Mocks
    • Manual vs. Automated Testing
    • Automated Testing with Selenium [Overview]
Conclusion
Request Pricing

Lecture percentage

50%

Lecture/Demo

Lab percentage

50%

Lab

Course Number:

JAV-312

Duration:

2 Days

Prerequisites:

All students must have a good working knowledge of Java and OO, including the use of interfaces, abstract classes, collections, factories, and generics. Experience with Java 8 lambda expressions is helpful, but not required.

Training Materials:

All JUnit 5 training students receive comprehensive courseware.

Software Requirements:

  • At least 8GB RAM
  • Any operating system that supports Java 1.8 or later
  • JDK 8 or later
  • Eclipse or IntelliJ
  • Other free software - please contact us if you have purchased this class

Contact Us:

Accelebrate’s training classes are available for private groups of 3 or more people at your site or online anywhere worldwide.

Don't settle for a "one size fits all" public class! Have Accelebrate deliver exactly the training you want, privately at your site or online, for less than the cost of a public class.

For pricing and to learn more, please contact us.

Contact Us Train For Us

Toll-free in US/Canada:
877 849 1850
International:
+1 678 648 3113

Toll-free in US/Canada:
866 566 1228
International:
+1 404 420 2491

925B Peachtree Street, NE
PMB 378
Atlanta, GA 30309-3918
USA

Subscribe to our Newsletter:

Never miss the latest news and information from Accelebrate:

Microsoft Gold Partner

Please see our complete list of
Microsoft Official Courses

Recent Training Locations

Alabama

Huntsville

Montgomery

Birmingham

Alaska

Anchorage

Arizona

Phoenix

Tucson

Arkansas

Fayetteville

Little Rock

California

San Francisco

Oakland

San Jose

Orange County

Los Angeles

Sacramento

San Diego

Colorado

Denver

Boulder

Colorado Springs

Connecticut

Hartford

DC

Washington

Florida

Fort Lauderdale

Miami

Jacksonville

Orlando

Saint Petersburg

Tampa

Georgia

Atlanta

Augusta

Savannah

Idaho

Boise

Illinois

Chicago

Indiana

Indianapolis

Iowa

Ceder Rapids

Des Moines

Kansas

Wichita

Kentucky

Lexington

Louisville

Louisiana

Baton Rouge

New Orleans

Maine

Portland

Maryland

Annapolis

Baltimore

Hagerstown

Frederick

Massachusetts

Springfield

Boston

Cambridge

Michigan

Ann Arbor

Detroit

Grand Rapids

Minnesota

Saint Paul

Minneapolis

Mississippi

Jackson

Missouri

Kansas City

St. Louis

Nebraska

Lincoln

Omaha

Nevada

Reno

Las Vegas

New Jersey

Princeton

New Mexico

Albuquerque

New York

Buffalo

Albany

White Plains

New York City

North Carolina

Charlotte

Durham

Raleigh

Ohio

Canton

Akron

Cincinnati

Cleveland

Columbus

Dayton

Oklahoma

Tulsa

Oklahoma City

Oregon

Portland

Pennsylvania

Pittsburgh

Philadelphia

Rhode Island

Providence

South Carolina

Columbia

Charleston

Spartanburg

Greenville

Tennessee

Memphis

Nashville

Knoxville

Texas

Dallas

El Paso

Houston

San Antonio

Austin

Utah

Salt Lake City

Virginia

Richmond

Alexandria

Arlington

Washington

Tacoma

Seattle

West Virginia

Charleston

Wisconsin

Madison

Milwaukee

Alberta

Edmonton

Calgary

British Columbia

Vancouver

Nova Scotia

Halifax

Ontario

Ottawa

Toronto

Quebec

Montreal

Puerto Rico

San Juan

© 2013-2019 Accelebrate, Inc. All Rights Reserved. All trademarks are owned by their respective owners.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.