use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceTypeFilteringResourceVisitorTest method testAfterPropertiesSetNoDelegatedVisitor.
public void testAfterPropertiesSetNoDelegatedVisitor() throws Exception {
ResourceTypeFilteringResourceVisitor filteringVisitor = new ResourceTypeFilteringResourceVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property delegatedVisitor must be set to a non-null value"));
filteringVisitor.setDelegatedVisitor(null);
filteringVisitor.setResourceTypeMatch("interfaceSnmp");
try {
filteringVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceTypeFilteringResourceVisitorTest method testAfterPropertiesSetNoResourceTypeMatch.
public void testAfterPropertiesSetNoResourceTypeMatch() throws Exception {
ResourceTypeFilteringResourceVisitor filteringVisitor = new ResourceTypeFilteringResourceVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property resourceTypeMatch must be set to a non-null value"));
filteringVisitor.setDelegatedVisitor(m_delegatedVisitor);
filteringVisitor.setResourceTypeMatch(null);
try {
filteringVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testDeleteLocationMonitorNullCommand.
public void testDeleteLocationMonitorNullCommand() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("command argument cannot be null"));
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
BindException errors = new BindException(command, "command");
replayMocks();
try {
m_distributedPollerService.deleteLocationMonitor(null, errors);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
verifyMocks();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedStatusServiceTest method testFindLocationSpecificStatusInvalidLocation.
public void testFindLocationSpecificStatusInvalidLocation() {
DistributedStatusDetailsCommand command = new DistributedStatusDetailsCommand();
Errors errors = new BindException(command, "command");
command.setLocation("invalid location");
command.setApplication(m_application1.getName());
expect(m_monitoringLocationDao.get(command.getLocation())).andReturn(null);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("Could not find location for location name \"" + command.getLocation() + "\""));
m_easyMockUtils.replayAll();
try {
m_service.findLocationSpecificStatus(command, errors);
} catch (Throwable t) {
ta.throwableReceived(t);
}
m_easyMockUtils.verifyAll();
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedStatusServiceTest method testCreateFacilityStatusTableNoEndDate.
public void testCreateFacilityStatusTableNoEndDate() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("argument end cannot be null"));
m_easyMockUtils.replayAll();
try {
m_service.createFacilityStatusTable(new Date(), null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
m_easyMockUtils.verifyAll();
}
Aggregations