Spock 7 best practices

August 3, 2016

In one of my previous post I wrote about the power and elegance of Spock testing framework. Here I will share 5 best practices we are in the team came with.

Practice #1: Use explicit name arguments for the data tables

Continue reading →

Testing with Spock

August 1, 2016

Lets start with a profound statement that one day would be nice to see Spock Framework to become the de-facto testing framework for JVM languages, at least for Java.

For many years, I, as many other Java developers, was using JUnit, Mockito, Hamcrest to power unit and integration testing. The day I found Spock - changed everything :) (at least in the area of testing).

Continue reading →

"You Build It, You Run It" a personal case study

July 22, 2016

There are a few things which I advocate and believe in (technically wise). One of them is that the team which has built the application, should be responsible for deploying and managing it solely by its own. So no need for a separate DevOps team. I have talked about this more in one of my previous blog post You are the DevOps.

And I am very upset and disappointed when there is a big gap between those two teams, if there is such a separation in the first place.

Continue reading →

Where is Optional.isEmpty()

July 20, 2016

When Optional was introduced in Java 8, one of the noticeable design decision was not to include any kind of isEmpty() method into Optional API. Comparing to Scala which tried to take advantage of Java 8 not yet being released, had Option class with both isDefined() and isEmpty() methods.

First it might seem like a flaw in JDK API design. But, lets try to step out and think.

Continue reading →

Embrace final

July 18, 2016

Having immutability as the language feature by default is a very nice thing. That you know that everything you declare is immutable, and instead, you have to apply some "ceremony" to actually change the value of the thing, so it becomes very explicit to the reader that the value is changing.

Unfortunately Java doesn't have this by default. But Java has the final keyword (which has multiple semantics, to be precise, depends on the context), which can be used to embrace immutability into your codebase.

Continue reading →