use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoDsType.
@Test
public void testConstructorThresholdNoDsType() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'ds-type' value set"));
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setValue(1.0);
threshold.setRearm(0.5);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ThresholdEvaluatorHighLowTest method testConstructorThresholdNoRearm.
@Test
public void testConstructorThresholdNoRearm() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("threshold must have a 'rearm' value set"));
Threshold threshold = new Threshold();
threshold.setType(ThresholdType.HIGH);
threshold.setDsName("ds-name");
threshold.setDsType("node");
threshold.setValue(1.0);
threshold.setTrigger(3);
ThresholdConfigWrapper wrapper = new ThresholdConfigWrapper(threshold);
try {
new ThresholdEvaluatorStateHighLow(wrapper);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AccessPointMonitorConfigDaoJaxbTest method testAfterPropertiesSetWithBogusFileResource.
public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
Resource resource = new FileSystemResource("/bogus-file");
AccessPointMonitorConfigDaoJaxb dao = new AccessPointMonitorConfigDaoJaxb();
dao.setConfigResource(resource);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new MarshallingResourceFailureException(ThrowableAnticipator.IGNORE_MESSAGE));
try {
dao.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testDeleteLocationMonitorNullBindException.
public void testDeleteLocationMonitorNullBindException() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("errors argument cannot be null"));
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
replayMocks();
try {
m_distributedPollerService.deleteLocationMonitor(command, null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
verifyMocks();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedStatusServiceTest method testFindLocationSpecificStatusNullLocation.
public void testFindLocationSpecificStatusNullLocation() {
DistributedStatusDetailsCommand command = new DistributedStatusDetailsCommand();
Errors errors = new BindException(command, "command");
command.setApplication(m_application1.getName());
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("location cannot be null"));
try {
m_service.findLocationSpecificStatus(command, errors);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations