Posted by: joachimvandenbogaert | May 28, 2008

Unit tests for static methods

Today I accidentally found out that it is very useful to test static methods with a repetition of at least two times. I forgot to initialize some values which caused some tests to break in the same run. The first time the method was called, everything worked fine. But the second time it was called, the test broke.

Luckily I found the source quickly and easily. But – without the tests – I can imagine that you continue working without ever detecting the mistake and finding out about it too late, not remembering anymore the static initializers.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: