solutions send by juan and carmen (in java with mockito)