Skip to content



Hi, long time no see… I really had a lot of work to do, been doing some freelance work in the nighttime and then there’s certainly my family. And apart from that, my current setup for this years projects is working quite well, thanks to Spring Boot and NetBeans for example.

Recently i had some failing tests. I used to Mockito to verify method calls and though i was sure the tested code was correct, the test kept failing.

What was wrong? The verification of calls run before the next mock. So what was failing was the previous test and I was too stupid to see the navigable exception at first (and second…).

To avoid this behavior and make the test fail that actually fails verification, add the following to your test class:

public void validate() {

or run your test with the MockitoJUnitRunner.

Read some about this behavior in the Mockito API: Mockito.validateMockitoUsage.

How to screw up iMessages and FaceTime on your iDevice


Recently i managed to screw up iMessages and FaceTime on my phone. Well, not exactly i screwed up, but Apple did.

Some months back i changed my Apple ID but kept the old email address as verified other address in my Apple account. I changed all iCloud settings (Sharing etc.) on all Apple devices because they wouldn’t authorize. iMessages and FaceTime didn’t complain at this time, neither on iDevices nor on a desktop.

Some days ago i decided to change my password and then things went bad. iCloud settings complained as expected but so did iMessages and FaceTime.

The problem? Both programs kept the old Apple ID in their settings and as soon as i hit the Apple-Id button to change it, the modal dialogue that the password was wrong kept popping up. This was the case in both iMessage and FaceTime.

The solution? Hitting the dialogue and the settings button on my iPhone like a madman… I didn’t expect this to work and was ready to reset my phone but sometime my timing was right.

Well. Pretty bad UX fail on Apples side.

So, if you want to change your Apple ID, remember to change this in iMessages and FaceTime immediately if this programs don’t complain right away.

JaCoCo, Maven and NetBeans 8 integration


I was looking for a nice solution to measure the code coverage in my Spring Boot biking project.

It should support Java 8, Maven and for added bonus, my IDE.

I ended up using JaCoCo respectively the Maven plugin.

If you expect a lengthier post, i must disappoint you. All that was need to turn this:


into this


and also having a nice report like this (right click in NetBeans 8 on the project and choose “Code Coverage > Show Report…”)


was the following plugin declaration in maven:

		<!-- Application starter -->
		<!-- Configuration -->
			<!--  implmentation is needed only for Maven 2  -->
			<rule implementation="org.jacoco.maven.RuleConfiguration">
				<limit implementation="">
				<!--  implmentation is needed only for Maven 2  -->
				<limit implementation="">

That’s it. NetBeans 8 recognizes JaCoCo immediately and everything works (except for my project not reaching my self set limits). No additional installs, no weird maven problems. Awesome.

Also i had no problems with JaCoCo and Java 8 features of any kind.

Java 8: Grouping stuff


I needed a function to sum (and therefor group) the values of a map of objects to Integers. My first solution was something like

As you can see, i use the collect method with a custom supplier, accumulator and combiner. The supplier prepares a new map, the accumulator takes the map and an entry and then uses Map#merge to sum the values.

The combiner than merges all created maps with the same logic.

There’s a nicer solution:

Use Collectors.html#groupingBy. This static helper method takes a classifier and a downstream. The classifier acts the same way as a Group-By clause in SQL, the downstream performs the actual reduction (in this case, a sum).


Anyway, i have the slight feeling, i’m recreating a SQL syntax or at least using the idea.

Java 8: Sort or find maximum, minimum entries in maps


This is cool:

Map.Entry#comparingByKey and Map.Entry#comparingByValue. They both take another comparator or lambda that is used as a delegate for creating a Map.Entry comparator, that can be used to sort maps or find maximum and minimum pairs in a map by key or value like in the following example:

import java.time.LocalDate;
import java.util.Map;
import java.util.Random;
import java.util.TreeMap;
public class FindMaxMinInMaps {
    public static void main(String...a) {
	final Map<LocalDate, Integer> foobar = new TreeMap<>();
	// Fill a date -> int map with 12 random ints between 0 and 100, 
	new Random(System.currentTimeMillis()).ints(0,100).limit(12).forEach(value -> 
		foobar.put( + 1), 
	// print them for verbosity
	// get the maximum
	Map.Entry<LocalDate, Integer> max 
		= foobar
		    // from all entries
		    // stream them
		    // max, obviously
			    // this one is cool. It generates
			    // Map.Entry comparators by delegating to another
			    // comparator, exists also for keys
		    // Get the optional (optional because the map can be empty)
	System.out.println("Max is " + max);