blob: 550a572515545a45b821034c9f32ff6b075697dd [file] [log] [blame]
Index: src/test/org/apache/lucene/util/TestAttributeSource.java
===================================================================
--- src/test/org/apache/lucene/util/TestAttributeSource.java (revision 883074)
+++ src/test/org/apache/lucene/util/TestAttributeSource.java (working copy)
@@ -142,6 +142,7 @@
src.addAttribute(TypeAttribute.class) instanceof TypeAttributeImpl);
}
+ @SuppressWarnings("unchecked")
public void testInvalidArguments() throws Exception {
try {
AttributeSource src = new AttributeSource();
@@ -154,5 +155,12 @@
src.addAttribute(Token.class);
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException iae) {}
+
+ try {
+ AttributeSource src = new AttributeSource();
+ // break this by unsafe cast
+ src.addAttribute((Class) Iterator.class);
+ fail("Should throw IllegalArgumentException");
+ } catch (IllegalArgumentException iae) {}
}
}