Blog Archives

TDD is dead?

Ah, the good old “Is TDD dead?” debate. Such fun. I was listening to the same old arguments going round in circles, and I’ve heard them so often I was able to sit back and ponder, and had a couple

Posted in Uncategorized

Unit Testing Freemarker Templates

I encountered a defect arising from a Freemarker template, fixed it, and then wanted a better way of testing it than firing up the app and checking the effects visually in a browser. Ignoring for a minute whether or not

Posted in Clean Test Code, Hamcrest, JUnit, JUnit Rule

Hamcrest JSON Matchers

I couldn’t find a Hamcrest matcher for JSON that worked how I wanted, so I adapted the JsonAssert library. This allows you to use dot notation to specify the path to a node in a json string, and use any

Posted in Clean Test Code, Hamcrest

Why Clean Code Matters

An old favourite: For three days and nights the Java master did not emerge from his cubicle. On the fourth day the monks of the temple sent a novice to inquire after him. The novice found the master at his

Posted in Uncategorized

Dangerous Words

A department trialing the use of agile in a predominantly waterfall organisation sent a status update to the traditionalists in program management. It contained the phrase “backlog of technical debt”. To us in the Scrum world, that means one thing,

Posted in Uncategorized

Scrum Task Board Tips

Call it your story wall, call it your agile board, call it your scrum wall, call it what you like. I call it a task board, and I like to keep it simple. If you’re in a situation where you

Posted in Agile

Bean Mapping With ModelMapper

I’ve never found a satisfactory method for mapping bean properties. They always add too much ugly set-up code, especially for conditional mapping or type conversions. Perhaps ModelMapperĀ is the best so far. Let’s say you have a source bean with a

Posted in Java

Loading Resources In Tests

Some level of tests, let’s call it integration testing because it’s not technically unit testing, often need to load resources like XML samples from the file system. A talented developer I worked with recently, came up with this nice use

Posted in Clean Test Code, JUnit, JUnit Rule

Names Should Be Expressive When Writing Tests

It is still surprisingly common to see test methods named “test” followed by the name of a some method that’s going to be called. Sometimes you get a few words mentioning some other internal detail, like This sucks. I’m amazed

Posted in Clean Test Code, JUnit

Great Expectations

What’s the best way to handle expected exceptions in JUnit? If you want to inspect the contents of the exception and make assertions against it then there is only one clean way; Use the ExpectedException JUnit Rule. I’ve seen it

Posted in Clean Test Code, Hamcrest, JUnit, JUnit Rule