LUCENE-2088: add extra test

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@883079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-11-22 13:59:47 +00:00
parent a78e306082
commit 2e244caa17
1 changed files with 8 additions and 0 deletions

View File

@ -142,6 +142,7 @@ public class TestAttributeSource extends LuceneTestCase {
src.addAttribute(TypeAttribute.class) instanceof TypeAttributeImpl);
}
@SuppressWarnings("unchecked")
public void testInvalidArguments() throws Exception {
try {
AttributeSource src = new AttributeSource();
@ -154,5 +155,12 @@ public class TestAttributeSource extends LuceneTestCase {
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) {}
}
}