We all know its a good idea to avoid using out variables in Java. In almost every case the code can be split up to avoid the situation. Its bad semantics because when reading the code its not obvious which object passed, if any will get mutated. So the reader is forced to [...]
14
2009
16
2009
Test anti-patterns project, contributors wanted!
I deliberately wrote a poor quality test, so that I could show how easy it is to re-factor it to a better one. I was driven by having seen lots of such poor tests and to be honest I don’t want to see another of its ilk again. I might write a test like this myself, but I would never leave it like this. Its part finished, littered with cut and paste, poorly named methods and hard coded values.
I show how to re-factor the test using several patterns for test fixtures. The setup stage is often the worst bit of a bad test. If you want to contribute some of your own bad tests and example improvements, read the blog, download the project and contribute!
31
2009
Neat multiset in google collections API
This good thing was so small that I almost did not bother to blog it
But the devil is in the detail so here it is anyway.
I have this multi threaded application. One of the problems with integration testing it is, you can’t guarantee the order that messages will be written to a stream. [...]
24
2009
Testing java equals and hashcode methods
Equals and hashcode bugs can be difficult to track down. So why not test them? This blog shows how easy it is to code some tests
24
2009
IDE Generation of equals methods has its moments
This blog entry looks at the code generated by Eclipse and Netbeans and demonstrates why its a good idea to both test the code and review it thoroughly.