Add a SuppressWarnings annotation to suppress unchecked casts, plus a test.