tests 100% correct across Java and JS