use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testAddEventListenerTwoArgumentStringNullUeiList.
public void testAddEventListenerTwoArgumentStringNullUeiList() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("uei argument cannot be null"));
try {
m_manager.addEventListener(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 EventIpcManagerDefaultImplTest method testSendNowNullEvent.
public void testSendNowNullEvent() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("event argument cannot be null"));
try {
m_manager.sendNow((Event) null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JRobinRrdStrategyTest method testSampleSetFloatingPointValueWithExtraJunk.
/**
* This test fails because of
* <a href="http://bugzilla.opennms.org/show_bug.cgi?id=2272">bug #2272</a>
* in org.jrobin.core.Sample.
*/
@Test
@Ignore("fails due to bug 2272")
public void testSampleSetFloatingPointValueWithExtraJunk() throws Exception {
File rrdFile = createRrdFile();
RrdDb openedFile = m_strategy.openFile(rrdFile.getAbsolutePath());
Sample sample = openedFile.createSample();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new Exception("Some exception that complains about bogus data"));
try {
sample.set("N:1.234 extra junk");
} catch (Throwable t) {
ta.throwableReceived(t);
} finally {
m_strategy.closeFile(openedFile);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class XmlDataCollectionConfigDaoJaxbTest method testAfterPropertiesSetWithNoConfigSet.
/**
* Test after properties set with no configuration set.
*/
@Test
public void testAfterPropertiesSetWithNoConfigSet() {
XmlDataCollectionConfigDaoJaxb dao = new XmlDataCollectionConfigDaoJaxb();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property configResource must be set and be non-null"));
try {
dao.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AttributeMatchingResourceVisitorTest method testAfterPropertiesSetNoAttributeVisitor.
public void testAfterPropertiesSetNoAttributeVisitor() throws Exception {
AttributeMatchingResourceVisitor resourceVisitor = new AttributeMatchingResourceVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property attributeVisitor must be set to a non-null value"));
resourceVisitor.setAttributeVisitor(null);
resourceVisitor.setAttributeMatch("ifInOctets");
try {
resourceVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations