Latest Posts Under: Unit Testing

Recently I have been experimenting with a Code Kata, and in this post I’d like to share my experiences with it. Code Kata? Code Kata’s have been around for a while, but it really came into my attention while reading Chapter 6 from the book The Clean Coder by Robert C Martin. This chapter makes an anology that at your work you’re a performer like a musician and outside work you (should be, like a musician) practicing. (Of course, you will learn while at work, but that is not the point). But what is a… Read Article →

In one of my previous posts I blogged about refactoring I did for my hobby project. Robert C Martin has a nice video showing refactoring, using IntelliJ. Watch it here. You can also see why unit testing is so important, as with each change the unit tests are being ran in order to check if anything got broken.

Recently I had the oppertunity to explain some students about what unit testing was. I started off with the question of “What does unit testing mean?”. They gave different types of answers. One of them talked about the smallest piece of code. And even though he is ‘right’. I asked him to apply this knowledge to his current code where he said “But I don’t want to test my get/set methods, that is useless!”. And so, our definition of ‘unit testing’ became unclear again. So what is a unit test? According to this article on… Read Article →

Someone mentioned a mocking framework called Mockito some time ago to me. I am familiar with mocking frameworks, as I work with EasyMock quite a lot. I really like EasyMock, but I am curious about Mockito. I thought of trying it out a bit and write down my experiences along with a comparison with EasyMock. This is by all means not a very in-depth comparison, but I did find out some interesting things. In order to test out the mocking frameworks I have set up some code in place to test. The code to be… Read Article →

Did you ever need to just have an instance of a class you cannot instantiate because the default constructor is not available? Do you want to create a test instance just to be used in unit tests? Don’t want to break up the design of your code just for testing? This post might help you: Sample code: public MyClass { final int someField; private MyClass() { // may not use this someField = -1; } public MyClass(int someFieldValue) { someField = someFieldValue; } int getSomeField() { return someField; } } So lets say this class… Read Article →

Scroll To Top