use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class XmlDataCollectionConfigDaoJaxbTest method testAfterPropertiesSetWithBogusFileResource.
/**
* Test after properties set with bogus file resource.
*
* @throws Exception the exception
*/
@Test
public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
Resource resource = new FileSystemResource("/bogus-file");
XmlDataCollectionConfigDaoJaxb dao = new XmlDataCollectionConfigDaoJaxb();
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 ResourceTreeWalkerTest method testAfterPropertiesSetNoVisitor.
public void testAfterPropertiesSetNoVisitor() {
ResourceTreeWalker walker = new ResourceTreeWalker();
walker.setResourceDao(m_resourceDao);
walker.setVisitor(null);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property visitor 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 RrdStatisticAttributeVisitorTest method testAfterPropertiesSetNoEndTime.
public void testAfterPropertiesSetNoEndTime() throws Exception {
RrdStatisticAttributeVisitor attributeVisitor = new RrdStatisticAttributeVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property endTime must be set to a non-null value"));
attributeVisitor.setFetchStrategy(m_fetchStrategy);
attributeVisitor.setConsolidationFunction("AVERAGE");
attributeVisitor.setStartTime(m_startTime);
attributeVisitor.setEndTime(null);
attributeVisitor.setStatisticVisitor(m_statisticVisitor);
try {
attributeVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class RrdResourceAttributeUtilsTest method testLoadPropertiesNullRelativePath.
@Test
public void testLoadPropertiesNullRelativePath() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("relativePath argument must not be null"));
try {
RrdResourceAttributeUtils.getStringProperties(new File(""), null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class ResourceAttributeFilteringResourceVisitorTest method testAfterPropertiesSetNoDelegatedVisitor.
public void testAfterPropertiesSetNoDelegatedVisitor() throws Exception {
ResourceAttributeFilteringResourceVisitor filteringVisitor = new ResourceAttributeFilteringResourceVisitor();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property delegatedVisitor must be set to a non-null value"));
filteringVisitor.setDelegatedVisitor(null);
filteringVisitor.setResourceAttributeKey("ifSpeed");
try {
filteringVisitor.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations