mirror of https://github.com/apache/lucene.git
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:
parent
a78e306082
commit
2e244caa17
|
@ -142,6 +142,7 @@ public class TestAttributeSource extends LuceneTestCase {
|
||||||
src.addAttribute(TypeAttribute.class) instanceof TypeAttributeImpl);
|
src.addAttribute(TypeAttribute.class) instanceof TypeAttributeImpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void testInvalidArguments() throws Exception {
|
public void testInvalidArguments() throws Exception {
|
||||||
try {
|
try {
|
||||||
AttributeSource src = new AttributeSource();
|
AttributeSource src = new AttributeSource();
|
||||||
|
@ -154,5 +155,12 @@ public class TestAttributeSource extends LuceneTestCase {
|
||||||
src.addAttribute(Token.class);
|
src.addAttribute(Token.class);
|
||||||
fail("Should throw IllegalArgumentException");
|
fail("Should throw IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException iae) {}
|
} 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) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue