Small java bugfix
Add java tests