Kata 4 IO in java and ChainOfRes pattern