The Best Comments of June 2015

I think that the best part of writing a blog is to get comments from my readers.

Because I have learned a lot from my readers, I want to “reward” the best comments, help you to learn new things, and (hopefully) encourage people to leave more comments.

The rules are simple:

  • I select X best comments that were left on my blog during the previous month.
  • I link to these comments and explain why I chose them.
  • If the author of the selected comment has a blog, I add a link to her/his blog as well.

Enough with chit chat. The five best comments of June 2015 are (in chronological order):

The Five Best Comments of June 2015

Adam told me that it is possible to categorize automated tests (if you use JUnit 4.8 or newer) by using the @Category annotation. I selected this comment because it taught me something new and useful. I think that using the @Category annotation has the following benefits:

  • I can get rid of the stupid ‘IT’ prefix (or suffix).
  • It helps me to run some of my slow tests (end-to-end tests) only when the project is build on a CI server. I know that there are other ways to do this, but this looks very interesting.

Mark Perry wondered why property based testing isn’t getting more attention. Because I didn’t know what that term means, I thought that he was talking about writing assertions for property values. Oh boy, was I wrong. Anyway, Mark’s comment proves that I still have a lot to learn.

Arho Huttunen shared some of his testing tools. One of his tools is a library called tempus-fugit that helps you to write tests for concurrent code. Because I hadn’t heard about tempus-fugit before Arho told me about it, he earned a place on this list.

Arho Huttunen has a blog where he helps people to write better code. Check it out.

Kane asked a very good question about the exception handling of Spring MVC applications. The reason why I think that this comment is important is this:

I said that he can solve his problem by using either the @ExceptionHandler or the @ControllerAdvice annotation, but I cannot help wondering if there is a better way to solve this problem.

The thing is that most applications have similar requirements concerning HTTP status codes, and it makes no sense that everyone has to write the same code from the scratch. Do you know a better way to deal with this situation?

Fedor wanted to run the same integration test several times by using slightly different configuration. I was able to answer to his question, but my solution feels like a ugly hack. Can you provide a better answer?

1 comment… add one

Leave a Reply