Search in sources :

Example 1 with IllegalStateException

use of org.jboss.weld.exceptions.IllegalStateException in project core by weld.

the class BeanIdentifierIndexTest method testInvalidIndex.

@Test
public void testInvalidIndex() {
    BeanIdentifierIndex index = new BeanIdentifierIndex();
    index.build(Collections.<Bean<?>>emptySet());
    try {
        index.getIdentifier(-10);
        fail();
    } catch (IllegalStateException e) {
    // Expected
    }
    try {
        index.getIdentifier(0);
        fail();
    } catch (IllegalStateException e) {
    // Expected
    }
    try {
        index.getIdentifier(10);
        fail();
    } catch (IllegalStateException e) {
    // Expected
    }
}
Also used : IllegalStateException(org.jboss.weld.exceptions.IllegalStateException) BeanIdentifierIndex(org.jboss.weld.serialization.BeanIdentifierIndex) Test(org.junit.Test)

Aggregations

IllegalStateException (org.jboss.weld.exceptions.IllegalStateException)1 BeanIdentifierIndex (org.jboss.weld.serialization.BeanIdentifierIndex)1 Test (org.junit.Test)1