use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceTreeWalkerTest method testAfterPropertiesSetNoResourceDao.
public void testAfterPropertiesSetNoResourceDao() {
ResourceTreeWalker walker = new ResourceTreeWalker();
walker.setResourceDao(null);
walker.setVisitor(m_visitor);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property resourceDao must be set to a non-null value"));
m_mocks.replayAll();
try {
walker.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
m_mocks.verifyAll();
}
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();
}
Aggregations