Add test for JAVA-597.