use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JavaMailerTest method testJavaMailerWithEmptyMessageText.
@Test
@Ignore
public final void testJavaMailerWithEmptyMessageText() throws Exception {
JavaMailer jm = createMailer("Test message from testJavaMailer without MTA");
jm.setMessageText("");
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new JavaMailerException("Cannot have an empty messageText."));
try {
jm.mailSend();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JavaMailerTest method testJavaMailerWithEmptyFrom.
@Test
@Ignore
public final void testJavaMailerWithEmptyFrom() throws Exception {
JavaMailer jm = createMailer("Test message from testJavaMailer without MTA");
jm.setFrom("");
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new JavaMailerException("Cannot have an empty from address."));
try {
jm.mailSend();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JavaMailerTest method testJavaMailerWithNullMessageText.
@Test
@Ignore
public final void testJavaMailerWithNullMessageText() throws Exception {
JavaMailer jm = createMailer("Test message from testJavaMailer without MTA");
jm.setMessageText(null);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new JavaMailerException("Cannot have a null messageText."));
try {
jm.mailSend();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AbstractJaxbConfigDaoTest method testAfterPropertiesSetWithBogusFileResource.
public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
Resource resource = new FileSystemResource("/bogus-file");
TestJaxbConfigDao dao = new TestJaxbConfigDao();
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 JdbcDataCollectionConfigDaoJaxbTest method testAfterPropertiesSetWithNoConfigSet.
public void testAfterPropertiesSetWithNoConfigSet() {
JdbcDataCollectionConfigDaoJaxb dao = new JdbcDataCollectionConfigDaoJaxb();
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();
}
Aggregations