Fix ClassCastException in test.