Review completely the javalib

Could you please add a test for this behavior?