java tests: tweak and make stricter a couple of tests * tests/javasubst.test: Use proper m4 quoting. Add trailing `:' command. Enable `errexit' shell flag, and related changes. Prefer cat + here-doc over echo to append to configure.in. Make grepping of Makefile.in stricter. Add debugging output. Improve heading comments. * tests/javaprim.test: Likewise.