Now how to get from painful to joyful ... that is the question. Probably by just applying common sense and proper code structure to tests, not just production code.
I've done my share of painful, stupid things:
- the monolithic build system that had super-ant-tasks with laser vision
- the event subsystem that was really just JMS
- the custom deploy system that really should have been one of rsync or rpm
- the object persistence layer that was supposed to be super-generic, but was really tied super-close to the domain objects
- ... I'm sure I could go on