Chapter 15. GSBase

 

This chapter covers

  • Testing event sources with EventCatcher
  • Testing object serialization and cloning
  • Testing legacy objects for equality

GSBase (http://gsbase.sourceforge.net) is an open source project maintained by Mike Bowler. Mike is also the lead programmer for HtmlUnit, which we highlighted in chapter 13, “Testing J2EE Applications.” Mike decided to take his toolkit of useful Java classes—ones he had developed for his own use and found handy—and create a public project around it, so GSBase contains some general-purpose classes that you might be able to use in your own projects. In this toolkit are a few utilities to make testing with JUnit easier. Mike is a long-time JUnit user and a proponent of Test-Driven Development.

An experienced Java programmer, Mike has been writing Swing applications since, as he puts it, “before Swing 1.0.” As a result, GSBase contains some utilities for Swing programming, among which is EventCatcher, a way to verify Swing UI events. If you write Swing applications—and they are making a comeback as we write these words—then you can use EventCatcher to verify that your event listener receives the events you think it ought to receive. We include a recipe on using EventCatcher in this chapter.

15.1. Verify events with EventCatcher

15.2. Test serialization

15.3. Test object cloning

15.4. Compare JavaBeans using “appears equal”