Using Mockito to Unit Test Java Applications

Steve Neal Development, Java Programming, Tool support 23 Comments

If you’ve spent any time writing unit tests then you’ll know that it’s not always straight-forward. Certain things are inherently hard to test. In this post I’ll show you the basic principles of creating mock objects with a little help from the Mockito mocking tool. One common problem faced when unit testing is how to test one object when it …

Configuring MySQL on Mac OS X

Steve Neal Development, Tool support 1 Comment

I found the documentation for MySQL a little rough around the edges recently when I needed to change a configuration setting for it – everything seemed spread around their comprehensive PDF documentation and it took me a little while to fathom my way through it. It’s not often that changes to MySQL configuration need to be made. This post is, …

Using Assertions in Java

Steve Neal Development, Java Programming 1 Comment

I’ve been working on a project this week and have been delighted to see that the original team of programmers who developed it have made the effort to use assertions in their code. The assert keyword was introduced in Java 1.4 and has since been a sadly under-used language feature. Assertions offer developers a neat way to implement error detecting …

A Unix Command to Recursively Delete all .svn Folders

Steve Neal Development, Tool support 5 Comments

I recently needed to check out a project from Subversion and then delete all of the .svn files from the project directories. Google found me a few different ways to do this, but none of them seemed to deal with a case where some of the directory and file names had spaces or quotes in them – as mine did. After a little experimenting, I figured out how some simple Unix commands that could be combined using pipes to do this.