Chapter 16. Testing OSGi components

Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: Nothing works and they don’t know why.


This chapter covers

  • The OSGi dynamic module system
  • Mock testing of your modules
  • In-container testing of your modules

So far, we’ve been testing everything from the Java EE spec. All the Java EE components that we’ve dealt with (JSPs, tag libraries, servlets, filters, EJBs, and so on) have been available for a long time. In this chapter we discuss a technology that became popular relatively recently and is getting more popular every day: OSGi.

We start the chapter by introducing OSGi[1] We then walk ...

Get JUnit in Action, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.