Loops performance in Groovy

IntroductionIn the 2018 Advent of Code challenged I solved all the puzzles in Groovy. It is pretty obvious, that choosing good data structure is the most important to obtain performant solution. However, the way we iterate over those structures is also very significant, at least when using Groovy.Measuring performanceI want to measure how long it takes to sum some numbers. For testing performance of loops I prepared a small

Testing Kotlin with Spock Part 3 – Interface default method

Kotlin allows you to put method implementation in an interface. The same mechanism can be found in Java interfaces as default methods (and also Groovy or Scala traits). Let’s see the difference between the Kotlin and Java default methods in interface by testing it with Groovy and Spock.What do we want to test?We often have an interface for access object from the database. In domain, they

Testing Kotlin with Spock Part 2 – Enum with instance method

The enum class with instance method in Kotlin is quite similar to its Java version, but they are look a bit different in the bytecode. Let’s see the difference by writing some tests using Spock.What do we want to test?Let’s see the code that we want to test:enum class EnumWithInstanceMethod { PLUS { override fun sign(): String = "+" }, MINUS { override fun sign(): String = "-" }; abstract fun