use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testRemoveEventListenerNullListener.
public void testRemoveEventListenerNullListener() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("listener argument cannot be null"));
try {
m_manager.removeEventListener((EventListener) null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testAddEventListenerTwoArgumentListNullListener.
public void testAddEventListenerTwoArgumentListNullListener() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("listener argument cannot be null"));
try {
m_manager.addEventListener((EventListener) null, new ArrayList<String>(0));
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testRemoveEventListenerTwoArgumentStringNullUeiList.
public void testRemoveEventListenerTwoArgumentStringNullUeiList() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("uei argument cannot be null"));
try {
m_manager.removeEventListener(m_listener, (String) null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class SnmpMonitorStrategyTest method testErrorConditions.
@Test
public void testErrorConditions() {
SnmpValue result = int32Value(1);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("operator X is unknown"));
try {
monitor.meetsCriteria(result, "X", "123");
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class SnmpMonitorStrategyTest method testErrorConditions2.
@Test
public void testErrorConditions2() {
SnmpValue result = int32Value(1);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new NumberFormatException("For input string: \"abc\""));
try {
monitor.meetsCriteria(result, "<", "abc");
fail("expected an exception");
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations