提交 ea9748e1 编写于 作者: K kohsuke

adding a test case.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21768 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8e048b86
......@@ -687,10 +687,9 @@ public abstract class HudsonTestCase extends TestCase {
if(pd==null) {
// field?
try {
Field f1 = lhs.getClass().getField(p);
Field f2 = rhs.getClass().getField(p);
lp = f1.get(lhs);
rp = f2.get(rhs);
Field f = lhs.getClass().getField(p);
lp = f.get(lhs);
rp = f.get(rhs);
} catch (NoSuchFieldException e) {
assertNotNull("No such property "+p+" on "+lhs.getClass(),pd);
return;
......
......@@ -27,6 +27,7 @@ import hudson.model.FreeStyleProject;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.FailureBuilder;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.Email;
import org.jvnet.mock_javamail.Mailbox;
import javax.mail.Address;
......@@ -72,4 +73,26 @@ public class MailerTest extends HudsonTestCase {
url.setValueAttribute("http://localhost:1234/");
assertTrue(p.getDocumentElement().getTextContent().contains("instead of localhost"));
}
@Email("http://www.nabble.com/email-recipients-disappear-from-freestyle-job-config-on-save-to25479293.html")
public void testConfigRoundtrip() throws Exception {
Mailer m = new Mailer();
m.recipients = "kk@kohsuke.org";
m.dontNotifyEveryUnstableBuild = true;
m.sendToIndividuals = true;
verifyRoundtrip(m);
m = new Mailer();
m.recipients = "";
m.dontNotifyEveryUnstableBuild = false;
m.sendToIndividuals = false;
verifyRoundtrip(m);
}
private void verifyRoundtrip(Mailer m) throws Exception {
FreeStyleProject p = createFreeStyleProject();
p.getPublishersList().add(m);
submit(new WebClient().getPage(p,"configure").getFormByName("config"));
assertEqualBeans(m,p.getPublishersList().get(Mailer.class),"recipients,dontNotifyEveryUnstableBuild,sendToIndividuals");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册