use of hudson.tasks.Mailer in project hudson-2.x by hudson.
the class DescribableListUtilTest method testConvertToProjectProperties3.
@Test
public void testConvertToProjectProperties3() throws IOException {
Hudson hudson = createMock(Hudson.class);
Mailer.DescriptorImpl descriptor = createMock(Mailer.DescriptorImpl.class);
String mailerName = "hudson-tasks-Mailer";
expect(descriptor.getJsonSafeClassName()).andReturn(mailerName);
expect(hudson.getDescriptorOrDie(Mailer.class)).andReturn(descriptor);
mockStatic(Hudson.class);
expect(Hudson.getInstance()).andReturn(hudson).anyTimes();
prepareJob();
DescribableList<Publisher, Descriptor<Publisher>> list = new DescribableList<Publisher, Descriptor<Publisher>>();
list.add(new Mailer());
Map<String, ExternalProjectProperty<Publisher>> map = DescribableListUtil.convertToProjectProperties(list, job);
assertNotNull(map);
assertEquals(map.size(), 1);
assertNotNull(map.get(mailerName));
assertEquals(map.get(mailerName).getValue().getClass(), Mailer.class);
}
use of hudson.tasks.Mailer in project configuration-as-code-plugin by jenkinsci.
the class MailerTest method configure_mailer.
@Test
@ConfiguredWithCode("MailerTest.yml")
public void configure_mailer() throws Exception {
final Jenkins jenkins = Jenkins.getInstance();
final Mailer.DescriptorImpl descriptor = (Mailer.DescriptorImpl) jenkins.getDescriptor(Mailer.class);
assertEquals("4441", descriptor.getSmtpPort());
assertEquals("do-not-reply@acme.org", descriptor.getReplyToAddress());
// FIXME setAdminAddress is deprecated and should NOT be set this way
// see https://github.com/jenkinsci/mailer-plugin/pull/39
assertEquals("admin@acme.org", descriptor.getAdminAddress());
}
Aggregations