[SPARK-2862] Fix for a broken test case and add new test cases

[SPARK-2862] Fix a typo, add a test case, modify a test case