cs: fix bugs in java source and generated tests

all tests now pass!