Course 442:
JEE Test-Driven Development:
Writing Effective Unit and Integration Tests

(2 days)


Course Description

Testing JEE applications can be challenging. Testing early, often, and real is important but the need for deployment in the JEE world makes this a non-trivial task. JEE components often interact with resources or sub systems of the container. In addition, declarative services such as dependency injection, transactions, and security are applied to the components at run time, all increasing the potential complexity of writing effective tests.

This course aims to show how JEE systems can be built using a test first approach. Using a combination of unit tests, mocking, and Arquillian integration tests, the course shows and provides practical experience of developing JEE applications guided by tests.

Best practices as well as pragmatic trade-offs are discussed and a priority given to deciding on what should be tested at the unit and integration level. Effective use of Mockito is also covered. A large part of the course is hands-on.

The course uses JBoss as the application server.

Learning Objectives

  • Write and maintain effective JEE unit tests
  • Use mocking correctly for JEE components
  • Write integration tests for JEE using Arquillian
  • Decide what to test at the unit and integration level
  • Adopt a test first approach to building JEE systems and components

Who Should Attend

This course is suitable for anybody who is involved in developing JEE applications.


A working knowledge of JEE is assumed and also of JUnit and Mockito.

Course Outline

Setting the Scene for JEE Testing

  • What Is Different in the JEE World?
  • The Tools Available
  • Test-Driven JEE Development

JEE Unit Tests

  • JEE Unit Tests
  • The Role (if any) of Mocking in JEE Unit Tests
  • Knowing What to Test at the Unit Level
  • Writing Effective Unit Tests

JEE Integration Tests

  • Where to Start Integration Testing
  • Where to End Integration Testing
  • The Role (if any) of Mocking in Integration Tests
  • Arquillian for Integration Tests
  • Appropriate Things to Test at the Integration Level
  • Selecting the Correct Arquillian Mode for Integration Tests
  • Creating Effective Deployment Units
  • Testing CDI and EJB Components
  • Testing Declarative Services
    • Timers
    • Interceptors
    • Transactions
    • Security
  • Testing REST Services

Please Contact Your ROI Representative to Discuss Course Tailoring!