My latest coding challenge was in Java. It was even trickier than my last challenge, because this time I needed to include automated tests.

I love having automated testing to run as I write code, so I can pass the tests, and check off the boxes. Who doesn’t?! The hard part is having the discipline and the know-how to write those tests in the first place.

It’s been a very long time since I’ve programmed in Java at all – long before ever thought about automated testing – or even knew about Test Driven Development as a concept. So it took me some time to learn about junit, and how to write unit tests in Java.

This github page has a very nice, succinct example of how to test a basic class in Java. It was actually extremely helpful to look at and emulate that pattern. While my tests probably could be better in a lot of ways, I was able to get them working properly, and then write all the code I needed in order to pass them. I really look forward to getting feedback on this challenge, because I want to get better and faster at writing good tests. It will make me a much better and disciplined developer!