Move couple tests from java to scala, w/ other minor improvements.